Track visits to your knowledge base with Google Analytics 4 (GA4). You add your Google tag to Helpcenter once, and your knowledge base pages report to your GA4 property.
Note
Custom JavaScript is available on the Business and Unlimited plans.
What gets tracked
Page views on your knowledge base website: the home page, categories and articles.
Page views in the widget's Help tab, because your tag also runs there.
Anything GA4 collects automatically for your data stream (enhanced measurement), such as scrolls and outbound clicks.
Helpcenter doesn't send its own events, such as AI search, chat or article feedback, to Google Analytics. For those numbers, see How does Helpcenter Analytics work?
GA reports the address your visitors see, including your custom domain or subfolder.
Copy your Google tag
In Google Analytics, go to Admin (gear icon) and open Data collection and modification › Data streams. Choose your web stream.

Your Measurement ID starts with G-, for example G-ABC123XYZ9. Scroll down and click View tag instructions.

Choose Install manually and copy the code snippet. It looks like this:
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ABC123XYZ9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-ABC123XYZ9');
</script>

Paste it into Helpcenter
Go back to your Helpcenter dashboard and click the gear icon at the bottom left. Go to Knowledge Base › Knowledge bases, select your knowledge base and open the Custom code tab.
Paste the whole snippet, including the <script> tags, into Custom JavaScript and click Save changes. The code is added at the end of every page.

Using Google Tag Manager? Paste your GTM <script> snippet into Custom JavaScript instead, and manage GA4 from GTM. You can add GTM's <noscript> snippet to the same box.
Check that it's working
Open your knowledge base in a new browser window and visit a few articles. Then, in Google Analytics, go to Reports › Realtime overview. Your visits should appear within a minute or two.
Tip: Ad blockers can hide your own visits, so test in a browser without one.
Still need help?
Contact us