GA4 Import: How to Migrate Historical Google Analytics Data into statpx
Switching to statpx doesn't have to mean losing years of Google Analytics history the day you flip the switch. The GA4 Import page (ga_import.php) connects to a GA4 property via OAuth and pulls in your historical daily sessions, users, and pageviews as a separate, read-only overlay — so your old data stays visible right alongside everything statpx tracks natively going forward.
Why Import Instead of Just Switching
Most teams evaluating alternatives to Google Analytics want a clean cutover, but a clean cutover with zero history makes month-over-month and year-over-year comparisons impossible for a while. GA4 Import solves that by letting you keep referencing last year's numbers even though statpx wasn't installed yet. It's explicitly an overlay, not a merge — imported GA4 rows are stored separately from statpx's own hits/sessions tables, so there's no risk of double-counting a visitor who's tracked by both systems during an overlap period.
Enabling the Two Required Google APIs
GA4 Import reuses the same Google Cloud OAuth client as Search Console, but it needs two additional APIs turned on before it will work — this is the step people miss most often:
- Open console.cloud.google.com and select the Google Cloud project tied to your OAuth client.
- Enable the Google Analytics Data API — this is what actually returns the historical metrics.
- Enable the Google Analytics Admin API — this is what lets statpx list the GA4 properties and accounts you have access to, so you can pick the right one.
Connecting Your GA4 Property via OAuth
From the GA4 Import page for a site, click connect and sign in with the Google account that has access to the GA4 property you want to pull from. Once authorized, statpx lists the account summaries visible to that login so you can select the specific property — useful if one Google account manages several sites. After you confirm the property, the first import runs and backfills your available historical range.
How the Overlay Works — No Double-Counting
Imported GA4 data lives in its own table (imported_stats), aggregated at the daily level — sessions, users, pageviews, bounces, and average duration per day — rather than at the individual-hit level statpx uses for its own tracking. Dashboards that show a combined trend line stitch the two sources together at the day boundary: GA4-imported days for history before you installed the statpx snippet, native statpx data for every day after. Because the two datasets never overlap by design (imported data only covers days before your statpx tracking went live, or is clearly labeled where it does), there's no risk of a visitor being counted in both totals for the same day.
Keep your GA history when you migrate to statpx
Connect a GA4 property and pull in your historical sessions, users, and pageviews as a read-only overlay — no gaps in your reporting timeline. Privacy-friendly, no cookies required.
Start for free →The Bottom Line
GA4 Import removes the biggest practical objection to switching analytics tools: losing your baseline. Enable the two Google APIs, connect the right property, and you get a continuous historical view instead of a hard cutoff on the day you installed statpx. From there, everything new — real-time data, the tracking snippet, campaigns, attribution — runs on statpx's own first-party data, while your past performance stays exactly where you left it.