Knowledge Base      


How do I add tracking pixels or JavaScript code to Shopify?


In this article, we’re going to show you where to install tracking pixels and tracking code in Shopify. But, before you read further, if you don’t already have a good understanding of where to install tracking pixels on an HTML page, the rest of this document will make more sense if you review this article first:
 
What are tracking pixels and tracking code?

To begin tracking Shopify sales, just follow the steps outlined below…


Step 1 - Add your Click Tracking Code to the theme.



You can get your Click Tracking code by clicking on “Website Code” from the Campaigns Tools Menu:

 

  
And inside of Shopify click on “Online Store” 

 

 
Click on “Actions” followed by “Edit Code”
 
 

 
Under “Layout” select the theme.liquid file and add the Click Tracking Code after the opening <head> tag.
 
 

  
Note: If you plan on getting traffic organically, you’ll want to use the Organic Click Tracking code instead of the code shown above. For more info, please checkout the article below:

How do I track organic traffic with Campaigns?


 
Once that is done, Save your changes.

Step 2 - Add your Sales Conversion Code.



To do this, just click on “Settings” and click “Checkout.”

 

 
In the “Order Processing” section in the “Additional scripts” for the “Order Status Page” add the Sales Conversion Code below:

    <script>
        window.clickmagick_cmc = {
            uid: '[USERID]',
            hid: '[HID]',
            cmc_goal: 's',
            cmc_ref: '{{ order_number }}',
            cmc_amt: '{{ total_price | money_without_currency }}',
        }
    </script>
    <script src='//cdn.clkmc.com/cmc.js'></script>


And that’s it! With the above setup you can now track your Shopify Sales.

If you use a Post-purchase app like Zipify, then you’ll want to follow the steps outlined in the article below:

How do I track Shopify Sales when using a Post-purchase apps like Zipify?

Article 594 Last updated: 05/31/2022 3:34:39 PM
https://www.clickmagick.com/kb/?article=594