Add Web behavior tracking to your Shopify store

Learn how to add our Web behavior tracking script to your Shopify store.

Overview

We store data collected from the Web behavior tracking script as Webinsights. This data lets you harness your customers' and prospects' activity on your website after clicking through from one of your campaigns or browsing your store from a known Shopify customer account.

Browsing activity is captured, stored and then made available for use in creating segments, capturing visitor browsing data, and sending abandoned cart campaigns.

To learn more about Web behavior tracking, check out the article Understand Web behavior tracking.

Step 1: Create a Web behavior tracking profile

To set up your Web behavior tracking profile and get your unique ID:

  1. In Dotdigital, go to Settings () > Access, then select the Web behavior profiles tab.
  2. Select NEW PROFILE.
  3. For Name, enter a name for your profile.
    This can be anything you want, but make it recognisable.
  4. For Website domains, enter each domain you want to add the tracking script to.
    - Max: 15 unique domains.
    - Exclude https://www – for example, example.com.
  5. Select CREATE.
  6. If you want to use Abandoned cart on your store:
    1. On Web behavior tracking profile, switch on Track abandoned carts.
    2. If you want to enable guest carts, switch on Enable guest carts.
  7. Copy your Unique ID. You’ll need this in Step 2.
  8. Select SAVE.

Step 2: Add the Web behavior tracking script

To add our Web behavior tracking script to your Shopify store:

  1. In Shopify admin, go to Sales channels > Online Store > Themes.
  2. Expand the Actions drop-down menu, then select Edit code.
    shopify-edit-code.png
  3. Under Layout, select the file theme.liquid.
    shopify-liquid-theme.png
  4. Before the </head> tag, paste the following code.
    Make sure you embed the code between <script>...</script> tags.

    var dm_insight_id ='uniqueID';

    (function(w,d,u,t,o,c){w['dmtrackingobjectname']=o;c=d.createElement(t);c.async=1;c.src=u;t=d.getElementsByTagName
    (t)[0];t.parentNode.insertBefore(c,t);w[o]=w[o]||function(){(w[o].q=w[o].q||[]).push(arguments);};w[o]('track');
    })(window, document, '//static.trackedweb.net/js/_dmptv4.js', 'script', 'dmPt');
  5. Replace the placeholder %uniqueID% in the code with your Web behavior tracking profile ID. This is the ID you copied in Step 1.8.
    replace-uniqueid.png
  6. Select Save.

Check it's working

Once you've set up Web behavior tracking on your Shopify store, it can take up to one hour before you start seeing data reflected in Dotdigital.

To check you're tracking data and associating it to a contact correctly:

  1. Send yourself a test campaign that includes a link to your store.
    To learn how, check out the article Create, test, and send an email campaign.
  2. Open the link from the email, and browse a few pages of your store.
  3. Wait one hour, then in Dotdigital, go to Email > Contacts > All contacts.
  4. Find and select the test contact you sent the test campaign to.
  5. On their contact profile, select the Insight data tab, and look for Webinsights data.

 

Did you find this article helpful?

Can we help?

Thanks for using Dotdigital. If you need more help or support, then contact our support team.