Step 1: Get Your Axo Script
- Go to the menu on the top right
≡and navigate toSettings - Click
Sites. - Select the site you wish to integrate, or create one if you haven’t already.
- Go to
Install, then copy the embed script.
Step 2: Add the Axo Script to Your Discourse Theme
You’ll be embedding the Axo script into your site’s<head> by editing your Discourse theme. Here’s the easiest and cleanest method:
- Go to your Discourse Admin Panel.
- Navigate to
Customizeand then toThemes. - Choose the theme you’re using.
- Click
Edit CSS/HTML. - Switch to the
<head>tab. - Paste your Axo script at the bottom.
- Click
Save.
Step 3: Ignore Canonicals and Enable SPA Tracking
Because Discourse comes with a canonical link to your homepage baked into the default/core setup, you’ve got to deactivate the use of canonical links.Since Discourse is a single-page app (SPA), which means it dynamically loads new content without reloading the page, you have to enable SPA mode.
- Go to the menu on the top right
≡and navigate toSettings - Click
Sites. - Select the site you wish to integrate.
- Deactivate the
Use canonicalscheckbox. - Set
Single Page Application (SPA) modetoauto. - Click
Save.
Step 4: Test Your Setup
- Open your Discourse forum in another window.
- Visit your Axo Analytics dashboard.
- You should start seeing real-time page views.