Problem

When using the Discount Ninja Sales Channel Shopify generates a checkout that, unfortunately, is not compatible with the standard Google Analytics integration.

This results in checkouts and orders placed via the Discount Ninja Sales Channel not being tracked properly.

Solution

NOTE: this solution is based on advice provided by Google representatives in the context of a specific online store. You may need to tweak this approach depending on your own requirements and implementation. We advise that you reach out to an expert in Google Analytics if the approach below does not work for you.

A script must be run at checkout to track the checkout properly.

If you are using Shopify Plus you can add this script to the checkout.liquid file.

If you are not using Shopify Plus, follow these steps:

Step 1: Open Sales Channels > Online Store > Preferences

Step 2: Find Google Analytics section

If your Google Analytics section is empty, you'll need to add your account and save.

If an account is configured, you'll find a link "Add custom JavaScript" below:

Step 3: add script

Click the link found in step 2 and add the following script:

<script async src="https://www.googletagmanager.com/gtag/js?id=<ACCOUNT>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<ACCOUNT>');
</script>

Step 4: replace placeholders

Notice that the script contains two instances of the combination <ACCOUNT>

You'll need to replace that with your Google Analytics account.

Did this answer your question?