All Collections
Advanced Topics
Integration
Google Analytics for Discount Ninja Sales Channel
Google Analytics for Discount Ninja Sales Channel

Learn how to re-enable tracking of checkouts with Google Analytics when using the Discount Ninja Sales Channel

Bart Coppens avatar
Written by Bart Coppens
Updated over a week ago

IMPORTANT NOTE: Discount Ninja Sales Channel is no longer supported by Shopify, we recommend removing it if you have it installed. This article explains how to remove it.

Problem

When using the Discount Ninja Sales Channel Shopify generates a checkout that, unfortunately, is not compatible with the standard Google Analytics integration. This seems to be caused by the fact that a checkout through the channel happens on your xxx.myshopify.com domain rather than on your custom shop domain.

This results in checkouts and orders placed via the Discount Ninja Sales Channel that are not tracked properly by third-party pixels, such as Google Analytics.

Solution

The preferred solution is to disable the Discount Ninja Sales channel. The sales channel is an optional feature of the app. It brings two additional capabilities. The first capability allows for adding discount codes at checkout on top of Discount Ninja promotions. You can use the cart promotion code field feature of the app as an alternative. The second allows for the use of free shipping offers that are country or delivery method specific. There is no workaround for this aspect.

Unfortunately, the sales channel has a number of known limitations, which are listed in the app.

To disable the Discount Ninja Sales channel, find Settings > Checkout options in the menu. Then, in the "Stack discount codes at checkout" tab, switch the setting to "None".

Workaround 1

To inform Google Analytics that checkouts happen via the xxx.myshopify.com domain, you need to add the correct exclusions in the Referral Exclusion List, found in the Tracking Info section of the property in Google Analytics.

The Referral Exclusion List should contain:

  • checkout.shopify.com

  • paypal.com

  • pay.shopify.com

  • your domain: e.g. myshop.com

  • your xxx.myshopify.com domain: e.g. myshop.myshopify.com

Workaround 2

NOTE: this workaround 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?