Table of Contents
How to Set Up Google Analytics on Your Website or Blog
Want deeper insights into your website traffic? While PublishFi comes with powerful built-in web analytics for most users’ needs, you can also add Google Analytics for advanced tracking or integration with other Google services. This guide will show you how!
Why Use Google Analytics (and When You Don’t Need To)
For most creators, PublishFi’s built-in analytics are more than enough. You can:
- Track visitors, pageviews, and growth trends
- See your most popular content
- Understand your audience—all from the Website tab
➡️ Learn more about built-in analytics
But you might want Google Analytics if you:
- Need to combine data from multiple sites
- Want to use Google Ads or Search Console
- Require advanced custom event tracking
Step 1: Get Your Google Analytics Tracking Code
- Go to Google Analytics and sign in (or create an account).
- Create a new property for your site if you haven’t already.
- Follow the prompts to set up a data stream for your website.
- On the Installation Instructions page, select Install manually.
- Copy the Global Site Tag (gtag.js) script provided by Google. It looks like this:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
--TODO: add image here--
Step 2: Add the Tracking Code to Your PublishFi Site
You can add your Google Analytics code to all pages or to an individual page.
A. Add to All Pages (Site-wide)
- Go to Account and Settings in your PublishFi dashboard.
- Click Pages in the left sidebar.
- Under Page Settings, select General.
- Scroll down to the Custom Code section.
- Paste your Google Analytics script into the Start of <head> tag box.
- Click Save.
--TODO: add image here--
B. Add to a Specific Page Only
- In Account and Settings, click Pages and select the page you want (e.g., Home, /blog).
- Scroll to the Custom Code section for that page.
- Paste your script into the Start of <head> tag box.
- Click Save.
--TODO: add image here--
Tip: Scripts added to an individual page override the site-wide script for that page.
Step 3: Verify Tracking is Working
- Publish your site if you haven’t already.
- Visit your website in a new browser tab.
- In Google Analytics, go to Realtime to see if your visit is tracked.
If you see activity, you’re all set!
Best Practices & Troubleshooting
- Only add your script once (either site-wide or per page, not both).
- It may take a few minutes for data to appear in Google Analytics.
- For privacy, always disclose analytics tracking to your visitors if required by law.
Related Articles
Need help? Reach out to Support or check our other integration guides.