Skip to main content
All CollectionsE-commerce integration
Tracking Your Shopify Products With PeerClick
Tracking Your Shopify Products With PeerClick

Shopify is a leading commerce platform that allows anyone to set up their online store presence and sell their products. Thanks to integration with Peerclick, you can track various events from your Shopify store in Peerclick with ease.

Updated over 2 weeks ago

File:Shopify logo 2018.svg - Wikipedia

Shopify is a leading commerce platform that allows anyone to set up their online store presence and sell their products. Thanks to integration with Peerclick, you can track various events from your Shopify store in Peerclick with ease.
โ€‹

Using Peerclick with Shopify enables marketers or ecommerce store owners to connect all their advertising efforts in one place. With it, they can see how their ads are doing and how it translates to selling numbers.
โ€‹

The following article covers the setup for tracking visits and tracking conversions.

Before you start

You require several things to be able to track your Shopify-powered store products with Peerclick:

  • An active Shopify account with:

    • A valid payment provider added,

    • A store created and products added,

    • Optionally, a custom domain set up.

    • Optionally, Shopify Plus subscription

  • An active Peerclick account, with a tracking domain that has an SSL certificate enabled.

    Peerclick Note: Using an encrypted connection is a requirement in Shopify. If you do not have an SSL certificate enabled on your either dedicated or custom domain, conversion tracking will not work.

Visit tracking

Shopify allows you to use many sales channels, which include:

  • Online Store

  • Facebook

  • Google Shopping

  • Other

In order for the tracking to work, you need to direct your visitors to your store through a Peerclick campaign URL. If you fail to do so, no click ID value will be assigned, and no conversion tracking will be possible. You can submit this campaign URL manually to any source of traffic, such as various ad networks. Activation of this campaign URL will be counted as a visit in Peerclick.

There are two methods you can use to track your Shopify store:

  • A direct one, where you put Peerclick tracking script directly on your store's page (main or product). This requires having Shopify Plus, as it allows adding codes to store pages. Create a campaign with just a Shopify offer and direct link to it. Put the offer tracking script on your store's page.

  • An indirect one, where you direct your visitors from your sales channel to an external landing page with Peerclick script in it and then from this landing page to your Shopify store's page. This does not require having Shopify Plus. Add a lander to Peerclick and create a campaign with a lander. Put a lander tracking script on your landing page and then redirect visitors to your store's page.

Add Shopify products as offers in PeerClick

To be able to create a complete campaign funnel in PeerClick, you need to have offer elements added to PeerClick, with links to product pages submitted as offer URLs.

PerClick Note: If you run the following campaign funnels:
* Offers Only + Redirect
* Landers & Offers + Organic
* Landers & Offers + Direct
* Landers & Offers + Redirect


you should also add the following parameters to the offer URL after the ? character: cid={clickid}.

  1. In PeerClick, go to Offers Source.

  2. Click the New button and select the Shopify option from the template menu.

  3. Click the Create Offer Source button.

Adding a store

  1. In PeerClick, go to Offers.

  2. Click the New button and select the Offer option from the drop-down menu.

  3. In the New offer form, provide a name for the offer in the Offer name text field.

  4. Click the Save button.

Repeat the steps above until you add all products as offer elements to PeerClick .

Track Conversions

In PeerClick understanding, each product page is treated as a separate offer. When a visitor completes an order, a Peerclick conversion tracking pixel that you have submitted on your Shopify account settings page will run. This pixel will then fetch a click ID from the visitor's cookie and pass it to Peerclick, along with some additional information, such as product price or order ID.

Peerclick Note: In order to use a conversion tracking pixel feature, a visitor must have cookies enabled in his or her web browser. Without cookies enabled, conversion tracking will not work. Additionally, the same domain and protocol have to be used in all campaign funnel

I. Get Conversion Tracking Pixel from Peerclick

In the first step, we describe where to obtain a conversion tracking pixel. In order to get it, perform the following steps:

  1. In PeerClick, click the button to go to the Settings page.

  2. Go to the Tracking URLs tab.

  3. In the Shopify pixel for order status page and post-purchase page section, click the Copy button next to the conversion tracking pixel to copy it to the clipboard.

    Your conversion tracking pixel should look as follows:

    analytics.subscribe('page_viewed', (event) => {
    let urlParams = new URLSearchParams(window.location.search);
    let pckCid = urlParams.get('cid');
    if (urlParams.get('cid')) {
    setSessionClickID();
    }
    function setSessionClickID() {
    sessionStorage.setItem('pckCid', pckCid);
    }
    });

    analytics.subscribe('checkout_completed', (event) => {
    let pckCid = sessionStorage.getItem('pckCid');
    if (pckCid != null) {
    pckCid = getSessionClickID()
    sendPeerclickConversion()
    }
    function getSessionClickID() {
    return sessionStorage.getItem('pckCid')
    }

    function sendPeerclickConversion() {
    xhrr = new XMLHttpRequest;
    xhrr.open("GET", "https://track.yourdomain.com/conversion.js?userid=your_userid&cid=" + pckCid)
    xhrr.send();
    console.log(xhrr)
    }
    });

    You need to modify this pixel to include Shopify tracking tokens:

    • Delete the cid=OPTIONAL part of the script

    • Replace the OPTIONAL next to the payout parameter name with the {{ total_price | money_without_currency }} Liquid tag.

    • Replace the OPTIONAL next to the txid parameter name with the {{ order_number }} Liquid tag.

    The modified pixel should look like this:

    <img src="https://track.yourdomain.com/conversion.js?payout={{ total_price | money_without_currency }}&txid={{ order_number }}" width="1" height="1"/>

II. Submit a Conversion Tracking Pixel to Shopify

Shopify offers an option to include an additional custom event on a product order page. You need to submit the PeerClick conversion tracking pixel as this additional custom event to enable conversion tracking. Follow the steps below:

  1. In Shopify, go to the Settings page.

  2. Go to the Custom events view.

  3. In the Custom events section Click the Add custom pixel button and paste the conversion tracking pixel in the Code text field.

  4. Click the Save button.

analytics.subscribe('page_viewed', (event) => {
let urlParams = new URLSearchParams(window.location.search);
let pckCid = urlParams.get('cid');
if (urlParams.get('cid')) {
setSessionClickID();
}
function setSessionClickID() {
sessionStorage.setItem('pckCid', pckCid);
}
});

analytics.subscribe('checkout_completed', (event) => {
let pckCid = sessionStorage.getItem('pckCid');
if (pckCid != null) {
pckCid = getSessionClickID()
sendPeerclickConversion()
}
function getSessionClickID() {
return sessionStorage.getItem('pckCid')
}

function sendPeerclickConversion() {
xhrr = new XMLHttpRequest;
xhrr.open("GET", "https://track.peerclick.com/conversion.js?userid=15254&cid=" + pckCid)
xhrr.send();
console.log(xhrr)
}
});
Did this answer your question?