Using Google Analytics with Redirect

Google has made users aware of the coming end to Universal Analytics for some time, but the date is fast approaching. As of July 1, 2023, Google's Universal Analytics will stop processing data. It is imperative users migrate to Google Analytics 4 prior to July 1, 2023 as Universal Analytics will stop processing.

This is a change in how your Google Analytics operates and changes your Google Analytics ID. Please follow Google's instructions on how to successfully transition to GA4, here:

Make the switch to Google Analytics 4

Google Analytics and Google Ads need special consideration when crossing domains. To properly track activity from storefront to checkout to completed sale requires additional setup on each site. Without these steps tracking information is lost when it crosses domains.

Google has posted detailed information on how to setup, configure and implement Google Analytics. On the Checkout Champ side, a standard GA4 integration should only require you add your GA4 ID (G-XXXXXXX) to your Tracking Pixels settings. Entry of a Google Analytics Tracking ID in Checkout Champ automatically places the Google Analytics tracking code on your checkout site.

For more involved implementations or custom scripting, please refer to Google's GA4 setup documentation, here:

https://support.google.com/analytics/answer/9304153?hl=en&ref_topic=9303319&sjid=14315089847360302476-NA

Please note: Google states cross-domain tracking is not required for subdomains using GA4. For example, a store redirecting traffic from a store front at “domain.com” to a checkout at “checkout.domain.com” should not require cross-domain tracking setup.

However, for checkout flows where your storefront may reside at “mystore.com” and your checkout resides on a separate domain, like “mycheckout.com”, you would need to implement Cross-Domain Tracking (also known as cross-domain measurement). In most cases, enabling Cross-Domain Tracking should only require configuration in your Google Analytics Data Streams.

Please follow Google documentation to setup cross-domain measurement, here:

Checkout Champ Setup

For typical implementations, you need only add your GA4 ID to your funnel settings following the steps below.

  1. Add Google Analytics to your funnel by opening the Tracking Pixels section of your Funnel Settings:

 

2. To auto-generate the GA4 tracking script, paste your tracking ID (G-XXXXXXXXX) in the space provided for "Google Analytics / G4 / Tag Manager".

3. Be sure to click "Save & Continue". Then publish your funnel to activate the tracking script.

Alternately, you can add custom tracking scripts to the “Custom Head Tracking Code” section. This should only be done for non-standard implementations or use of custom tracking scripts. In all cases, be sure to click "Save & Continue". Then publish your funnel to activate the tracking script.

If you enter your ID in the "Google Analytics / G4 / Tag Manager" input field DO NOT add the same ID to the custom script section. This setup is “either/or”: EITHER use the "Google Analytics / G4 / Tag Manager" input field OR use the custom script section.

All other setup steps should be configured via the “Data Streams” in your Google Analytics Admin settings. Please follow Google’s documentation, here:

Example Setup

The following outlines the steps we took to test Cross-Domain Tracking with GA4. Your setup may be different, but the basics should be the same. Once again, please refer to Google’s documentation to setup, test and adjust as required for your implementation:

For our testing, we followed these steps based on Google’s documentation:

  • Ensure the GA4 ID/tracking script was added to both domains.

  • Navigate to your GA4 Property and click on "Data Streams".

  • Click on "Configure tag settings" followed by "Configure your domains". Match type should be "Contains". Then enter your domains without the "https://". You do not need to add subdomains. Only enter separate root domains.

In order to ensure your domains do not show up as referral traffic, add both domains to your referral exclusion list.

  • Navigate to "Configure tag settings" in your Data Streams settings.

  • Click "Show all" and navigate to "List unwanted referrals". Match type should be set to "Referral domain contains" and each domain should be entered without the "https://". You do not need to add subdomains. Only enter separate root domains.

Again, Google has posted detailed information on how to setup, configure and implement Google Analytics. On the Checkout Champ side, a standard GA4 integration should only require you add your GA4 ID in your Funnel settings. For more involved implementations or custom scripting, please refer to Google's GA4 documentation, here:

Shopify Redirects

With the switch to GA4, Shopify has moved to the new Google & YouTube Channel to connect Google Analytics. Like our integration, this channel allows you and Google to manage the GA4 integration via the Google Analytics Admin settings. You will need to enable the Google & YouTube Channel and connect your GA4 ID. Shopify recommends hiring a Shopify expert if you need help setting up the integration or configuring a more complex implementation.

To link your GA4 property to Google Ads, navigate to your Property Settings and select "Google Ad Links".
Click "Link", select your Google Ads and follow the on-screen prompts.

For More Information

For detailed information regarding the setup and configuration of Google Anlaytics, please refer to Google's GA4 documentation, here:

 

 

 

DEPRECATED: Information below this point refers to Universal Analytics. This information will be kept available for a short time while UA and GA4 exist in tandem.

 

Google Analytics and Google Ads need special consideration when crossing domains. To properly track activity from storefront to checkout to completed sale requires additional setup on each site. Without these steps tracking information is lost when it crosses domains.

Entry of a Google Analytics Tracking ID in Checkout Champ automatically places Google Analytics tracking code on your checkout site. That code configures the checkout site to accept incoming tracking links from the storefront. This article explains the steps needed to send those tracking links along with the redirect.

General Setup

Add Google Analytics to your funnel:

 

Add your Google Analytics tracking ID to your Checkout Champ funnel by clicking on Settings, then Tracking Pixels. Paste your tracking ID (G-XXXXXXXXX) in the space provided for "Google Analytics or Tag Manager". Be sure to click "Save & Continue".

Your Checkout Champ funnel is now setup to use Google Analytics. However, when redirecting from another domain, you will also need to add both of your domains to the Referral Exclusion List within Google Analytics. This step will help ensure traffic is allocated to the correct source in your reports.

Add both domains to your Referral Exclusion List.

In Google Analytics, go to Admin. Then, under Property, click "Tracking Info". Click "Referral Exclusion List". Then click on "Add Referral Exclusion".

 

Add your first domain to the list and click “Create”. Then click on "Add Referral Exclusion" once more to add your second domain to the list.

Once your funnel and Google Analytics settings are configured, you're ready to complete the setup on your store's domain. You’ll need to copy the “gtag” script to use in your store setup. Click on Admin. Under “Property”, click on “Tracking Info” and then “Tracking Code”.

Copy the “Global Site Tag (gtag.js)” script.

 

 Shopify

Once logged into your Shopify store, you’ll need to click “Online Store”, then “Preferences”. Scroll down to the section for Google Analytics. This is where you will add the “gtag” script you copied from Google Analytics.

You’ll need to edit the latter portion of that gtag script to allow for Cross-Domain tracking from your store to your Checkout Champ funnel. This is done by adding “linker parameters” to tell Google Analytics to track visitors from your store’s domain to your checkout domain.

You can paste your gtag script and edit to add the lines from “gtag(config . . . “ to the ending }); brackets.

Alternately, you can copy/paste the script below. If you copy the script below, take care to enter YOUR Google Analytics UA ID and YOUR two domains.


<!-- Global site tag (gtag.js) - Google Analytics -->

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-XXXXXXXXX-X', {
'linker': {
'domains': ['YOURDOMAIN.com', 'YOURFUNNELDOMAIN.com'],
'decorate_forms': true
}
});


The final step to setup Shopify is to add the necessary linker code to the checkout redirect snippet in your Shopify store. You will need to edit the snippet you added when setting up the initial checkout redirect.

In Shopify, go to “Online Store” and click “Themes”. Under “Actions”, select “Edit Code”.

Navigate down to “Snippets” and find the checkout redirect snippet you added to setup your redirect. The file should be named "{NAME}-cart.js.liquid", where {NAME} is the name you originally gave your snippet.

 

Replace the “function checkout(event) code with the following code:


function checkout(event) { var checkoutUrl = getCheckoutURL(self.options.products); var destinationLink = checkoutUrl; debug('Checkout ->', checkoutUrl); event.preventDefault(); var tracker = ga.getAll()[0]; if(window.gaplugins) { var linker = new window.gaplugins.Linker(tracker); destinationLink = linker.decorate(checkoutUrl); } window.location.href = destinationLink; //window.location.href = checkoutUrl; }

 


Make sure to save the snippet.

Your store is now setup to track visitors from initial store visit to the end of your Checkout Champ checkout funnel.

 Track Conversions

There are countless ways to configure Google Analytics. One way to configure Google Analytics to track conversions is to setup Goals. You can setup a “Checkout Complete” goal to track the end of the checkout process, marking a conversion in your funnel.

To setup Goals in Google analytics, go to Admin. Under “All Web Site Data”, click on “Goals”. Then click “New Goal”.

Select “Checkout Complete” and click “Continue”.

Give your Goal a name and select “Destination” as the type. Then click “Continue”. In Goal Details, enter the url slug of your confirmation page from your funnel (/thankyou, /summary, etc.). Click “Save”.

 

To track Google Ads ad clicks data in Google Analytics, you'll need to make sure Google Ads and Google Analytics are linked and Auto-tagging is enabled. Following these steps:

To enable Auto-tagging, go to your Google Ads account and click on “Settings” in the left side menu. Then click “Account settings” and ensure “Auto-tagging” is checked.

Next, go to Tools and Settings, and click on "Linked Accounts". Select "Google Analytics (UA)" and complete the setup.

Then, in Google Analytics, go to Admin. Under Property, click "Google Ads Links". Complete the setup and ensure "auto-tagging" is saved.

For More Information:

If you are using the Checkout Champ API or other external resources, you can find more information on how to set up Google Analytics to track across domains, here:

https://developers.google.com/tag-platform/devguides/cross-domain