How can I activate site tracking for your Shopify webshop?

This article applies to users who are using Deep Data integration for Shopify. The Shopify Deep Data integration is available with a Plus and Professional subscription.

You can track page visits to your Shopify website with site tracking. This way, you can create automations based on visits to your website.

In this article:


What is site tracking?

With site tracking, you can see which web pages on your website have been visited by contacts known within your MailBlue account. You can track these website visits by adding your unique MailBlue site tracking code to your website. Additionally, you need to whitelist your domain within your MailBlue account. Each MailBlue account has a unique site tracking code.

When contacts visit your website, these page visits are recorded in your MailBlue account. This data then appears in the contact profile under 'recent activities'.


How are contacts identified with site tracking?

Contacts need to be identified in order to link their page visits to their contact profile in your MailBlue account. We identify contacts in the following ways:

  • A contact submits a form that you have created in MailBlue. The form must redirect the contact to a page on your site where the site tracking code is installed.
  • A contact clicks on a hyperlink in a campaign or automation email that takes them to a page on your site where the site tracking code is installed.
  • You pass the contact's email address in the site tracking JavaScript code.

How do I add site tracking to my Shopify website?

There are two ways to add site tracking to your Shopify website. How site tracking is added depends on the date you connected your Shopify website to your MailBlue account. Both options are outlined below.


Connection made on or after 27 April 2021

Once you have connected Shopify with MailBlue, you will be prompted to install the 'ActiveCampaign CX Automation' app in your website. Once this app is installed:

  • The site tracking code will be automatically added to your website.
  • Your domain will be automatically whitelisted within your MailBlue account.

To view your whitelist, click on 'Website' > 'Website tracking' in your account.


Connections made before 27 April 2021

If you connected your Shopify website to your MailBlue account before 27 April 2021, you will need to manually whitelist your domain in your MailBlue account and manually add the site tracking code to your website.

Below you can find instructions on how to manually whitelist your domain and how to manually place the site tracking code on your Shopify website.

  1. Click on 'Website' in the left menu of your MailBlue account.
  2. Click on 'Website tracking'.
  3. Click on the 'Enable' switch to set it to 'ON'. This is located in the 'Website tracking' section.
  4. Under 'Trusted list and installation code', you can whitelist your domain by adding it to the trusted list. Do this by entering your domain name in 'Add Website URL' and clicking on 'Add'.
  5. Next, copy the 'Tracking code' and paste it into a text file. You will need this to make small adjustments to the code.
  6. In the text file where you have inserted the 'Tracking code', remove <script type="text/javascript"> at the top and </script> at the bottom. These elements are JavaScript tags that are not necessary for a Shopify webshop.
  7. Save the modified code in the text file as plain text and make sure it uses a JS extension. Note: TextEdit on Mac uses Rich Text by default. You will need to convert the TextEdit file from Rich Text to Plain Text to obtain the correct file format.
  8. Then, go to the backend of your Shopify webshop and navigate to 'Sales Channels' > 'Online Store' > 'Themes'. To place the site tracking on your Shopify environment, it needs to be added to the theme you are using.
  9. From 'Themes', click on 'Actions' and choose 'Edit Code' from the drop-down menu to modify the theme code.
  10. In the code folders, look for 'Assets' and click on 'Add a new asset' to insert the previously modified code.
  11. Select the file saved in step 7 and then click on 'Upload asset'.
  12. Once this is completed, go to 'Layout' at the top of the page and click on 'theme.liquid'. Within the head section, add the following: {{ 'MailBlue_Tracking.js' | asset_url | script_tag }}

    Note: 'MailBlue_Tracking.js' is an example file name. You will need to insert your own JS file name here. Make sure to include your file name in all layouts.

  13. Click on 'Save' when you are finished.

How do I check if the code has been successfully placed?

To verify if you have successfully installed the site tracking code in your Shopify webshop, go to the public page of your store and then open the 'developer console'. In the developer console, you will see a page with your added JS file and the MailBlue tracking code.

Opening the developer console varies per browser. For more information, read through the following links: Chrome, Firefox, Internet Explorer.

How do I deactivate site tracking?

You can disable site tracking for your Shopify webshop at any time. To do this, log in to your MailBlue account, go to 'Settings', and then navigate to 'Tracking'. Once on the 'Tracking' page, uncheck 'Website tracking' next to your whitelisted domain(s).

You can also toggle the switch at 'Website tracking' > 'Enable'. Setting this to 'OFF' will deactivate site tracking and turn it off immediately for all whitelisted domains.

Was this article helpful?
0 out of 0 found this helpful