Google Analytics (GA4)
Loop’s Google Analytics 4 integration allows you to track the recurring order transactions of subscriptions along with your non-subscription transactions and thus providing a complete picture of your store revenues in your main GA4 account.
If you are just getting started, then we recommend to read this Google help doc to help you understand how GA4 works and how to get migrated from Universal Analytics to GA4.
In this article, we will cover
- Server-side integration avoiding the need to add Google tag manager or any tracking scripts separately for the Loop app.
- For every event sent on GA4, we add the Shopify customer id as the user id which helps in linking different subscription order events to a common customer.
- We only send transaction data for recurring orders and not the origin order generated from Shopify checkout preventing duplication of the same order.
Types of events
Recurring order successful transactions
Whenever a recurring order billing is attempted, we send out GA4 events having the products, price, quantity, tax, shipping information related to the order.
Payment failed events
Whenever a recurring charge attempted from Loop fails, we send out GA4 events having the subscription_id, value, failure_reason information related to the order.
Subscription life-cycle events
Along with the transaction events, we also send important subscription events which can help you in analysing your store subscriptions performance.
Connecting GA4 account to Loop
To connect your Google Analytics 4 account, you would need to obtain “api_secret” and “measurement_id”.
- API secret key generated in GA4 account required to enable additional events to be sent into a specific data steam from an external server.
- To create a new API secret, navigate to Admin > Data Streams > choose your stream > Measurement Protocol > Create
- Measurement ID associated with a specific data stream in GA4.
- It can be found under Admin > Data Streams > choose your stream > Measurement ID
Steps to look up API Secret and Measurement ID
- Click on the admin icon (at the bottom) and select relevant account and GA4 property to connect over to Loop. Then click on the "Data Streams" option.
- Choose one of the data streams in which you would want to receive the Loop events. If no stream added yet, click "Add stream" to add one and choose the "Web" option.
- When you click on a data stream, you would be able to see Stream details bar on top of the drawer. The left most option will be showing the Measurement ID of the stream as highlighted in the screenshot below. Copy and paste this value in the Measurement ID field of Loop Set up instructions page.
- Click on the "Measurement Protocol API" secrets option as highlighted in the screenshot below.
- If you have not generated any API secrets yet, it is highly likely that Google would want you to acknowledge the terms before creating an API secret. In that case, click on the "Review terms" button and acknowledge the terms.
- Once you acknowledged the terms, you would be able to see "Create" button. Click it to create a new API Secret.
- Choose a name for the API secret, preferably "Loop subscriptions" for future reference.
- Once, you click on "Create" button, you would be able to see the newly generated API secret. Copy and paste this value in the API Secret field of Loop Set up instructions page.