All posts

How to Migrate from Google Analytics to Self-Hosted Analytics

June 28, 20265 min read

Should you migrate off Google Analytics?

If any of these apply, migrating is worth it:

  • You want to own your data instead of sending it to Google.
  • You are tired of the cookie consent banner GA4 forces.
  • You find GA4's interface slow and confusing.
  • You need GDPR compliance without legal gymnastics.
  • You want analytics that load fast and do not bloat your site.

Self-hosted, cookieless analytics solves all of these — see the open-source alternatives compared. Here is how to switch cleanly.

Step 1 — Run both in parallel first

Do not rip out GA4 on day one. Install your new analytics alongside it for a week or two. This lets you compare numbers, build confidence, and confirm tracking works before you remove anything.

<!-- Keep GA4 for now -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXX"></script>
<!-- Add InsightsTrack -->
<script src="https://your-domain/api/sites/YOUR_SITE_ID/script"></script>

Step 2 — Understand the metric differences

Numbers will not match GA4 exactly, and that is expected (and usually a good thing):

  • No bot inflation — cookieless first-party tracking filters far more noise.
  • Different "session" logic — most privacy tools use simpler, more honest session definitions.
  • Country from timezone, not IP — slightly different geo distribution, but no IP stored.

Focus on trends, not absolute parity. If both tools agree your traffic is up 12% week-over-week, you are tracking correctly.

Step 3 — Recreate your key reports

Map what you actually use in GA4 to the new tool:

GA4 reportInsightsTrack equivalent
RealtimeRealtime page (live visitors + map)
Acquisition / Traffic sourcesAcquisition (sources + UTM)
Pages and screensPages
Conversions / EventsFunnels + Conversions
EngagementEngagement (scroll depth, rage clicks)

Step 4 — Move your UTM campaigns

Your existing UTM-tagged links keep working — InsightsTrack reads utm_source, utm_medium, utm_campaign, etc. automatically. No changes to your ad campaigns needed.

Step 5 — Set up goals and funnels

Recreate your GA4 conversions as goals and multi-step funnels so you can see drop-off between steps (e.g. Visit → Signup → Checkout → Purchase).

Step 6 — Remove GA4

Once you trust the new numbers, delete the GA4 script. Bonus: your site gets lighter — GA4's gtag.js is substantially larger than a privacy-first tracking script — and you can revisit whether your consent banner is still required for your jurisdiction.

Exporting your GA4 history first

Your historical data does not migrate — the schemas are fundamentally different — but you should not lose it either. Before you remove GA4:

  • Export the reports you actually reference as CSV from the GA4 UI: acquisition by channel, top pages, conversions, and monthly totals for the last two or three years.
  • Use the BigQuery export if you already have it linked. That is the only way to get event-level GA4 data out in bulk.
  • Screenshot your annotated milestones — launches, campaigns, redesigns — so future-you can explain a spike in the archive.

Keep those exports somewhere durable. The practical goal is being able to answer "how did last year compare" without keeping GA4 alive to do it.

Running the numbers side by side

During the parallel period, build one small comparison table each week rather than staring at two dashboards:

WeekGA4 sessionsNew tool sessionsRatio
W14,2104,9801.18
W23,9404,6101.17
W34,5305,2901.17

A stable ratio is the signal you want. It means both tools are seeing the same reality and simply counting differently — usually ad-blocker recovery on the self-hosted side. A ratio that swings week to week means something is genuinely misconfigured: a missing script on some templates, a SPA route change not firing, or a tag firing twice.

Common migration mistakes

  • Removing GA4 on day one. Without an overlap you have no way to tell a tracking bug from a real traffic change.
  • Not tagging the script on every template. Blog, docs, checkout, and error pages are the ones people forget. Crawl your own sitemap and confirm the script is present on each.
  • Ignoring SPA route changes. If your app is client-routed, confirm virtual pageviews fire on navigation, not just first load.
  • Forgetting server-side events. Purchases and signups should fire from your backend where they cannot be blocked or double-fired.
  • Comparing bounce rate across tools. GA4's definition is engagement-based and not comparable — see bounce rate explained.

Frequently asked questions

Can I import my historical Google Analytics data?

Not directly — GA4's export gives you aggregated reports, not the raw event stream, so there is nothing to replay into a new schema. The practical approach is to export the reports you care about as CSV for reference and start fresh.

How long should I run both tools in parallel?

Two to four weeks. That is long enough to see how the two count the same traffic, establish the ratio between them, and catch tagging gaps before you lose the GA4 safety net.

Why is my self-hosted traffic higher than GA4 reported?

Mostly ad blockers. A first-party script on your own domain is blocked far less than google-analytics.com, so you are seeing visitors GA4 never counted. Definitional differences in sessions and engagement account for the rest.

What should I do with my existing UTM links?

Nothing — UTM parameters are a URL convention, not a Google feature. Any analytics tool that parses query strings picks them up, so live campaign links keep working unchanged.

When is it safe to remove the GA4 tag?

Once your key reports are reproducible in the new tool, your goals and funnels are configured, and you have a parallel period showing a stable ratio between the two. Removing it before that leaves you with no baseline to debug against.

Migration checklist

  • [ ] Install new analytics alongside GA4
  • [ ] Verify pageviews and events are recording
  • [ ] Recreate key reports and goals
  • [ ] Compare trends for 1–2 weeks
  • [ ] Remove GA4 + cookie banner
  • [ ] Enjoy owning your data

Related: what cookieless tracking actually measures and how metric definitions differ between tools. Want a low-risk way to evaluate first? Explore the InsightsTrack live demo before you touch your site.

Try InsightsTrack free

Open-source, self-hosted, privacy-first analytics — explore the live demo, no install required.

Open live dashboard