Best way to implement Chartbeat

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. 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);

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

Here’s a screenshot:

Finally, I added the standard Chartbeat code on the </body> section in the Customize → CSS/HTML admin panel.

That’s it! :slight_smile: