All Collections
Technical Documentation
Shopify - Checking and Installing tracking tags
Shopify - Checking and Installing tracking tags

What to do if tracking tags aren't working for your Shopify shop.

Sam O'Neill avatar
Written by Sam O'Neill
Updated over a week ago

Tracking tags are an essential part of the services that AdCurve provide. We rely on our tracking tags for building visit analytics, customer journeys, adding conversion and retargeting pixels to shop pages and capturing orders. If our tracking tags aren't working, the analytics data available for your shop in AdCurve will be looking a little bare.

When you install our Shopify App we will create these tags for you automatically, but just incase it didn't work correctly, you can follow the steps below to try to add them.

Checking that our tags are working

There's two methods for testing that AdCurve's tracking tags have been successfully created on your shop. The first method is using our "S2MTag checker" app for Google Chrome. This is a small app that will check your shop pages for our tags, and display any information that it finds.

Another method for checking on any browser is to use the Developer Tools Console. 

First you'll need to open the developer tools for your browser, if you're not familiar with how to do this, here's some instructions for Microsoft Edge, Google Chrome, Mozilla Firefox, or press  cmd+opt+c if you're using Safari.

Once the console is open make sure first that you're on your shop's website in the current tab, and then type __s2mPixel and press enter. If the tag is there, you should see some information a little like this: 

If the pixel hasn't loaded, the response looks a little more severe: 

If you're on a product, category or cart page you can also check that our "configuration" script has loaded by typing s2m_configuration . This should result in a response that looks something like this: 

Manually adding Theme Assets

You'll need to manually modify the Shopify theme, do this first go to the Themes page inside Shopify from the left navigation panel: 

Then to "Edit code" from the theme actions menu: 

 

 The first file that you'll need to edit is "theme.liquid" under the "Layout" folder. Directly under the "<head>" tag we need to add the text {% include 'adcurve' %} , this instructs the main theme layout to add the AdCurve tag to each page: 


The next thing you'll need to do is actually add the 'adcurve' snippet that we just instructed the theme to include. If there's not already a file called "adcurve.liquid" under the Snippets folder you'll need to create it: 

Add a new snippet and just call it "adcurve": 

In the new snippet add the following javascript snippet and save.

<script type="text/javascript" id='adcurve_script'>
  window.s2m_configuration = new Object();
  {% unless customer.empty? %}
    window.s2m_configuration.s2m_customer_id = {{ customer.id | json }};
  {% endunless %}

  {% case template %}
    {% when 'index' %}
      window.s2m_configuration.s2m_page = "home";
    {% when 'cart' %}
      window.s2m_configuration.s2m_page = "cart";
      window.s2m_configuration.s2m_cart_items = [];
      {% for item in cart.items %}
        var s2m_item = new Object();
        s2m_item.s2m_product_id = {{ item.product_id | json }};
        s2m_item.s2m_name = {{ item.title | json }};
        s2m_item.s2m_quantity = {{ item.quantity | json }};
        s2m_item.s2m_amount_1 = {{ item.price | money_without_currency }};
        window.s2m_configuration.s2m_cart_items.push ( s2m_item );
      {% endfor %}
    {% when 'product' %}
      window.s2m_configuration.s2m_page = "product";
      window.s2m_configuration.s2m_product_id = {{ product.id | json }};
      window.s2m_configuration.s2m_product_name = {{ product.title | json }};
      window.s2m_configuration.s2m_amount_1 = {{ product.price | money_without_currency }};
    {% when 'collection' %}
      window.s2m_configuration.s2m_page = "category";
      window.s2m_configuration.s2m_category = {{ collection.handle | json }};
      window.s2m_configuration.s2m_category_path = {{ collection.handle | json }};
      window.s2m_configuration.s2m_products = [];
      {% for product in collection.products limit:5 %}
        var s2m_product = new Object();
        s2m_product.s2m_product_id = {{ product.id | json }};
        s2m_product.s2m_product_name = {{ product.title | json }};
        s2m_product.s2m_amount_1 = {{ product.price | money_without_currency }};
        window.s2m_configuration.s2m_products.push ( s2m_product );
      {% endfor %}
  {% endcase %}
</script>

The result should look like this: 

With these steps complete AdCurve will be able to collect product details from pages to build analytics for orders, and use product data in marketing pixels served through our Tag Manager.

Manually adding Script tags:

For the second part here you'll need to work out your AdCurve ShopId. This can be found in the address bar when viewing your account on AdCurve:  app.adcurve.com/shop/1234/... in this case the "1234" after the /shop/ is the shop number.

If you have any trouble finding your shop number or you're not quite sure, please don't hesitate to contact us for help.


Next you'll need to add your shopcode into the following snippet and add it to the "theme.liquid" file in Shopify as detailed in the instructions above.

<script src="https://track.shop2market.com/v3/update_tos.js?s2m_shop=[shop_id]&v=2.1.20190401"></script>

 The best place to add this is at the bottom of the "body" section of the layout. Find the </body>  tag near the bottom of the document and past the snippet in as shown here:

I've used the shopId "1234" in this example, but don't forget to replace this with your own shopId before saving.

Removing AdCurve Theme Assets and Script tags

If you uninstall the AdCurve app for Shopify we should automatically remove these theme assets. However, if it's not removed correctly there's two changes that need to be made to completely remove AdCurve theme assets from your shop. 

  1. Following the instructions above, edit the theme, navigate to the "theme.liquid" file under the Layout section, and delete the line {% include 'adcurve' %}

  2. Find the script tag at the bottom of the body section starting <script src="https://track.shop2market.com...  and delete this whole line. Save the "theme.liquid" file.

  3. Find the file "adcurve.liquid" under snippets, and delete the whole file. 

Did this answer your question?