How to set up Google Analytics in the right way for a Shopify app?
Understanding sources of traffic and installs is very important for your Shopify app to improve your listing and focus on the right channels for your marketing efforts. Without understanding your data, you can’t make data-driven decisions, which is important for the progress of your app.
Setting Google Analytics for your Shopify App
When you fill in your Shopify App Store listing information, you will notice the “Tracking Information” section where you must provide your G4 Measurement ID and API Secret.
First, go to https://analytics.google.com and create your account.
Fill in your account name
Create a Google Analytics property, and give it your app name to find it easier later.
Fill in some marketing details; these have no effect, just fill it.
Fill your objectives, not really critical; you can change them later.
Choose a platform, which is “web” in our case
Fill in the details of your app and create a stream
Now you have your Measurement ID
Next, you need your API Secret Key
Accept Terms
Click on the “Create” button to create an API Secret
Give your key a name to recognize it later easily
Ok, now you have your API Secret ✅ Copy and paste it to your listing.
When someone installs your app, Shopify will send you shop_id information. It is important to understand which store installed you from which source, so it is better to set this from the beginning; otherwise, you can’t get this information, and you can start getting it from the moment you make the setup.
Configure shop_id parameter
Go to the admin settings page.
Go to custom definitions
Click on “Create Custom Dimension.”
Add “shop_id” as a custom dimension. If auto-complete doesn’t work for the Event parameter, just ignore it and fill as you see in the screenshot.
Congratulations 🎉 You completed all the necessary steps ✅
Now you should wait for some data to come. To learn more about how Shopify is sending data to Analytics, you can read this article.
How to get the shop domain from shop_id?
You can paste your partner_id and shop_id in the URL structure below.
https://partners.shopify.com/<partner_id>/stores/<shop_id>
Update 26.09.2024 shop_url and shop_name parameters
Shopify introduced new parameters, such as shop_url and shop_name. Add them as a custom definition, the same as shop_id. You can see the changelog entry here.
Read your data in a meaningful and actionable way
I built rankbase.io, a tool that fetches all data from Google Analytics and displays you meaningfully. After you get some data, you can try it to see what your app store sources look like. You can see some screenshots from the Rankbase below.