Shopify Integration
David Rolenc avatar
Written by David Rolenc
Updated this week

In order to successfully integrate tracking of your Shopify store, you will need to set up your system by instructions in the Quick Setup section in the system and then tracking for clicks and conversions by following the guide below.

  1. In your Shopify admin environment, go to the section: Sales channels > submenu Online Store > submenu Themes. In the Current theme box, click on the "three dots" button > click on Edit Code in the dropdown.

  2. In the layouts folder, select the theme.liquid file and add the following code just before the </head> tag.

    <!-- Trackdesk tracker begin -->
    <script async src="//cdn.trackdesk.com/tracking.js"></script>
    <script>
    (function(t,d,k){(t[k]=t[k]||[]).push(d);t[d]=t[d]||t[k].f||function(){(t[d].q=t[d].q||[]).push(arguments)}})(window,"trackdesk","TrackdeskObject");

    trackdesk('YOUR TENANT ID', 'click');
    </script>
    <!-- Trackdesk tracker end -->

    Make sure to replace YOUR TENANT ID with your actual tenant ID.

  3. Save changes

  4. Next, in your Shopify admin environment, go to the section: Settings > Customer events.

  5. Add a custom event with following parameters
    Name - Trackdesk conversion script
    Permissions - Select "Not required"
    Data sale - Select "Data collected does not qualify as data sale"
    Code - paste the code below

    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.async = true;
    script.src = "//cdn.trackdesk.com/tracking.js";
    document.head.appendChild(script);

    analytics.subscribe("checkout_completed", event => {
    (function(t,d,k){(t[k]=t[k]||[]).push(d);t[d]=t[d]||t[k].f||function(){(t[d].q=t[d].q||[]).push(arguments)}})(window,"trackdesk","TrackdeskObject");

    trackdesk('YOUR TENANT ID', 'conversion', {
    conversionType: 'YOUR SELECTED CONVERSION TYPE',
    amount: {
    value: event.data.checkout.totalPrice.amount.toString()
    },
    externalId: event.data.checkout.order.id
    });
    });

    Make sure to replace YOUR TENANT ID with your actual tenant ID.

    Make sure to replace YOUR SELECTED CONVERSION TYPE with the conversion type you want to use for tracking.

  6. Use Save button to save the changes.

  7. Use Connect button to apply the changes to your website.

Testing Your Integration

Please remember to test the creation of click and conversion before starting your program. This way, you can verify that tracking has been set up correctly. You can create a test click and conversion by following the steps described here.

Did this answer your question?