Templates: affiliate networks


Shopify is the leading cloud-based, multi-channel commerce platform. Merchants can use the software to design, set up, and manage their stores across multiple sales channels, including web, mobile, social media, marketplaces, brick-and-mortar locations, and pop-up shops. The platform also provides merchants with a powerful back-office and a single view of their business. The Shopify platform was engineered for reliability and scale, making enterprise-level technology available to businesses of all sizes.

If you’re looking for a tracking tool that will help you gain insight into your e-commerce business, RedTrack might just be a perfect solution for you. In this article, we will show you how easy it is to integrate your Shopify store with RedTrack.

Since it is an advanced tutorial, it is not covered by RedTrack Support. Knowledge of web design languages such as HTML, CSS, JavaScript may be required. We suggest hiring an expert if you are not comfortable proceeding with the following guide on your own.

1. Assuming you already have a store, the first step you will need to do is creating a campaign in your RedTrack account. Since it’s an online shop, we understand how important it may be to track all types of incoming traffic – even organic. That is why we have a solution that works for all types of traffic you may have. If you want to track organic traffic as well, create + one more campaign for it. Here is more information on how to create a campaign in RedTrack.

2. Once a campaign is created, you will have all the necessary IDs generated automatically.

Copy it.

3. Go to your Shopify account -> Themes -> Actions -> Edit code

Go to theme.liquid -> put the following script in the header

Download the script from here.

The script is to be adjusted before:

– Update the organic campaign ID.
– Update the tracking domain everywhere in the script.

Don’t forget to save the changes.

4. Now you need to set the postback for your store.
Go to setting -> Checkout

Adjust the postback script and place it inside the additional scripts section:

– Replace the domain to the one you are using

function getCookie(name) {
var value = “; ” + document.cookie;
var parts = value.split(“; ” + name + “=”);
if (parts.length == 2) return parts.pop().split(“;”).shift();
var rtCookie = getCookie(‘rtkclickid-store’)
document.addEventListener(“DOMContentLoaded”, function() {
var capturedText = document.querySelector(“.total-line.total-line–subtotal>.total-line__price>.order-summary__emphasis.skeleton-while-loading”).innerText
capturedText = capturedText.substr(1);
capturedText = capturedText.replace(/,/g, ‘.’)
var request = new XMLHttpRequest();
request.open(“GET”, `https://your.tracking.domain/postback?clickid=${rtCookie}&sum=${capturedText}`)
request.success = function(response) {
request.fail = function(error) {
//and finally send it away

*If you plan to use it for several thank you pages, keep in mind that you will need to update the CSS selector accordingly.

5. Generate your tracking links and start tracking.
For the script to work properly, you need to add some additional parameters to your links.

Add rtkcid={clickid}&cmpid={campaignid} to your offer URL in RedTrack (your Shopify store URL). You can use the campaign URL to track your traffic.

Related Articles