With the recent events relating to Google Analytics platform, it's becoming very clear that the time has come for many of us to migrate from Google Analytics to different platforms.
In this article we will go over both the "Why?", so that you can make an informed decision whether you need to migrate of not, as well as the "How?" of migrating from Google Analytics - that is quickly and easily taking your data and moving to different analytics platform without too much hassle.
Why has now - all of a sudden - came time to ditch Google Analytics?
There are 2 main reasons why you might want to do so. First being that there have been court rulings in multiple EU countries stating that it's illegal to use Google Analytics in EU. This is because of data of EU citizens is being transferred to US, which violates GDPR rules. These ruling apply so far to France and Austria, but more are expected in 2022. So, unless Google decides to run GA infrastructure in EU pretty soon, then you might be left in legal hot water pretty soon.
Recently, US and EU leadership reached agreement on trans-Atlantic data privacy, which might alleviate this issue, but chances are that data privacy advocates won't be satisfied and will challenge this in courts.
The other reason to migrate off the platform is that Google is deprecating Universal Analytics) beginning 1 July 2023. You could migrate your GA properties to GA4 as advised by Google, the problem here's though that your old data won't move and you won't be able to compare or look back at analytics from let's say 2 years ago, which sucks.
The solution that "kills two birds with one stone" is to choose a privacy-friendly platform where you won't need to worry about GDPR rules and extract and move your data from GA to said platform, taking full ownership of your data and not having to worry about Google deprecating things whenever they please (which is very often).
If you decided that you want to or need to migrate, then here I present you a simple tool and process for exporting your analytics data and getting it into a format suitable for other platforms.
GA Extractor can help you extract any analytics data from Google Analytics without having to touch the API. Apart from performing basic data exports, it can also transform it into other formats besides default JSON - that being - a more readable CSV, which can be used in data analysis or SQL suitable for direct migration to other platforms.
Let's look at some examples. To install the tool just run:
pip install ga-extractor
# Usage: ga-extractor [OPTIONS] COMMAND [ARGS]...
From there you can set it up like so:
ga-extractor setup \
In the command above, you can see that you need to provide Service Account key file (
--sa-key-path) and Table ID (
--table-id, also referred to as View ID). You get these values using the guide in repository README or on PyPI page.
Running this command will generate a config file in an application config directory in
~/.config/ga-extractor/.... You can verify that the tool can authenticate with Google API by running
If you're unsure as to which metrics and dimensions to select, then you can use
--preset flag with
BASIC option to set the metrics and dimensions for you.
With tool configured, you can now run extraction:
ga-extractor extract --report="my-awesome-report.json"
# Report written to /home/user/.config/ga-extractor/my-awesome-report.json
cat /home/user/.config/ga-extractor/my-awesome-report.json | jq .
Now, in case the data format produced by Google API isn't suitable for your needs, then you can use
migrate command to extract and transform it into CSV or SQL:
ga-extractor migrate --format=CSV
# Report written to /home/user/.config/ga-extractor/02c2db1a-1ff0-47af-bad3-9c8bc51c1d13_extract.csv
# /,Chrome,Android,mobile,340x620,en-gb,United Kingdom,t.co/,1,2022-03-18
ga-extractor migrate --format=UMAMI
# Report written to /home/user/.config/ga-extractor/cee9e1d0-3b87-4052-a295-1b7224c5ba78_extract.sql
The CSV is much more readable than the default output, while the SQL can be used to migration to other platforms. The SQL here is tailored for Umami Analytics, but with some tweaks it could be applied to other platforms that track sessions and page views along with all the common metrics.
Be aware that the
migrate command overrides previously configured metrics and dimensions, so that it can produce meaningful results.
If you don't have a lot of data or you feel like the above is too much hassle for you, then you can also export some tables and views from GA web console. There are a lot of advanced/complex things you can export, but 2 most basic things you surely want take before leaving GA is page views and user sessions information.
To export page view count or really any aggregated metric, you can navigate to Audience and Overview, choose desired metric from dropdown and click export:
To export individual sessions you can navigate to Audience and User Explorer, and click export:
There are many more things you can grab from the console, and I recommend checking out this article which provides good overview.
Now that you have the data exported, or you maybe decided to leave GA behind without even taking the data, it's time to choose the new platform. There are many good privacy-friendly, open source, cheap/free GA alternatives. I won't go over every single one of these as there are great articles written about this, like this one with a list of open-source options.
If you exported data using the
ga-exporter tool presented above you have the option to transform it into format that can be readily inserted into Umami which makes it easy migration target. If you want to test it out, then you can spin up the service with Docker as described in docs, add your website as shown here and then just insert previously exported data with:
cat /home/user/.config/ga-extractor/cee9e1d0-3b87-4052-a295-1b7224c5ba78_extract.sql | psql -Upostgres -a db
You can then view the dashboard, which should show you your data like so:
Umami is my migration target, you might however have different preferences and needs. One thing to keep in mind though, when choosing your target platform, is full data "ownership", which is important to avoid vendor lock, which might otherwise make it hard to migrate in the future, if the need arises again. So, I'd recommend to look for a platform that makes it easy to export full analytics data in practical format(s) to make it easy to analyze your data or migrate elsewhere.
Even if you decide that you don't want to or don't need to leave Google Analytics at this time, it's good idea to explore some of the alternatives. Chances are that you don't need any of the advanced GA features, and you might just realize that the alternatives are actually more suitable for your needs.
There's also no need to be scared of self-hosting the analytics engine yourself. Many of the open-source solutions can be spun up in matter of minutes and require very little resources to run. Even data migration can be quite simple as you've seen earlier in this article. If that's the route you want to go, but the extractor tool presented here doesn't support the target platform you'd like to migrate to, or you have some feedback to share, then feel free to create and an issue in GitHub repository and I will definitely try to help out.