# Best way to implement Chartbeat

**URL:** https://meta.discourse.org/t/best-way-to-implement-chartbeat/58026
**Category:** Support
**Created:** [February 27, 2017, 4:51pm UTC](https://meta.discourse.org/t/best-way-to-implement-chartbeat/58026 "2017-02-27T16:51:19Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![frostydog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frostydog/32/68228_2.png) [@frostydog](https://meta.discourse.org/u/frostydog)
#### Post date: [February 28, 2017, 6:19pm UTC](https://meta.discourse.org/t/best-way-to-implement-chartbeat/58026/2 "2017-02-28T18:19:49Z")

</div>

I will answer myself for future reference, if someone needs to use Cloudflare with Discourse.

First: I followed @neil 's guide to [add Google Tag Manager in Discourse](https://meta.discourse.org/t/setup-google-tag-manager-for-analytics/47335). Why are we using GTM? We need to fire two Google Analytics tags and ComScore’s tag.

Then, I just created a new Custom HTML tag with the following code:

> `<script type="text/javascript">`  
> ` pSUPERFLY.virtualPage(location.pathname, document.title);`  
> `</script>`

Which fires everytime `virtualPageView` is invoked. On advanced settings I left the “fire once per event” option.

Here’s a screenshot:

 ![](https://global.discourse-cdn.com/meta/original/3X/7/5/75f3d60078599ec37f78c3f88fe65aea8f234270.jpg)

Finally, I added the [standard Chartbeat code](http://support.chartbeat.com/docs/#code) on the `</body>` section in the Customize → CSS/HTML admin panel.

That’s it! 🙂

---

_[View the full topic](https://meta.discourse.org/t/best-way-to-implement-chartbeat/58026)._
