Note: Our Shopify app now works to track marketing attribution for payments made via CartHook. To get this working you need to follow a few steps.

This script works with the GA cross domain linker, picking up a cookie ID from your website which we can link with the order once it's purchased on Shopify.

1. Go to your CartHook 'Global Scripts' page

2. Find the 'Checkout page scripts' box

3. Paste in the following script, after any other scripts which are already present.

// Start of Littledata script 

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){"use strict";n.r(t),n.d(t,"getGaCookie",function(){return r});var r=function(){if(document.cookie.length>0){var e=document.cookie.indexOf("".concat("_ga","="));if(-1!==e){e=e+"_ga".length+1;var t=document.cookie.indexOf(";",e);-1===t&&(t=document.cookie.length);var n=unescape(document.cookie.substring(e,t));if(n){var r=n.match(/(\d{2,11})\.(\d{2,11})/g);return r?r[0]:""}}}return""};window.getGaCookie=r}]);

$.post('https://transactions.littledata.io/clientID', {
    clientID: getGaCookie(),
    cartID: CHDataObject.checkout_session,
})

// End of Littledata script
     

4. Save the changes

5. Deactivate any Google Analytics tracking

There are two instances where tracking has to be disabled:

  • First you would go to 'Integrations & Tracking' and disable the Google Analytics integration 
  • Second would be to delete the tracker placed in the Shopify Checkout funnel and save

You will start seeing sales being attributed to your marketing channels in Google Analytics.

Did this answer your question?