API Integrations

Shopify Private App integration

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 be a perfect solution for you. This article will show you how easy it is to integrate your Shopify store with the RedTrack private app.

Follow the steps below:

1. Add your shop to RedTrack.io. 

1.1. Create a custom Offer Source: New->Create custom.

This is your shop and a placeholder for the tracking parameters. Set your shop name as the offer source name. 

1.2. Add postback parameters and assign relevant roles to each of them

This is the list of all supported parameters, you can choose only those you want to use in your tracking:

eventid={replace} add, assign role

email = {replace} add, assign role

phone = {replace} add, assign role

lname = {replace}  add, assign role

fname = {replace}  add, assign role

zip = {replace} add, assign role

сontentid={replace} add, assign role

contenttype={replace} – add, assign role (Facebook Content Category)

сontent={replace} – add, assign role (Facebook Content Name)

brand={replace} – add

1.3. Add offer – this is your shop URL. 

Ignore the clickid warning.

2. Create custom conversion events.

Tools -> Conversion tracking -> Conversion types -> White down the event names (you can also apply different duplicate postback modes for each of them on the right).

This is the list of events you’ll need to use but you can add other events you may need:

  • ViewContent
  • AddToCart
  • InitiateCheckout
  • Purchase
  • Upsell

3. Create tracking campaigns in RedTrack.

You might have several paid traffic sources (like Facebook or Google) or have only organic traffic. For each of your sources, you need to create a traffic source and a campaign. This will help you to have all the important data in place and grouped correctly.

3.1 Find more on Facebook and Google integration if you use any of them. If you work with some other paid traffic source, you can search for the integration guide here.

3.2 Add the traffic source for organic traffic. Add a custom source with the name “Organic” or anything else that will help you to identify it.

Leave the parameters and a postback field empty.

3.3 Create campaigns with each of your sources or traffic. For example, if you have Facebook and organic, you should create 2 campaigns.

Here is more on how to create a campaign. In most cases, your online shop will act as an offer, so your campaigns will have only this offer in the funnel.

4. Add a custom tracking domain.

Add a domain and an SSL certificate. If you don’t have a certificate, here is how and where you may obtain one.

5. Generate a Universal Tracking Script.

Tools -> Scripts -> New

Script type – select one of the 3 types.

  • default – choose this one if you plan to work with your own website (e.g. e-com store) where a visitor can click on any link or visit any tab while the target action is tracked always on some other page no matter what the visitor path was before.
  • /click support – use it when you lead the visitor from your landing page to a 3rd party offer and use domain.com/click CTA link format
  • /preclick support – same as /click support but for a prelanding page with domain.com/preclick CTA link

Title – give your script a name

Domain – choose a custom tracking domain that will be used in that script

Default campaign – organic traffic campaign created within step 1

Attribution – set the attribution model you want to use

  • First click – first recorded inbound click
  • Last click  – last recorded inbound click
  • Last paid click – last recorded inbound click with tracking parameters
    We recommend last paid click attribution for the majority of cases.

Attribution window – set the attribution window, the period for the first click, and last paid click models

Cookie domain – the 1party domain to place a cookie. This is your website domain, the one where you place the script.

Generated script – once you save the changes, the ready-to-use script will be generated

6. Create a Private App.

6.1. Login to your Shopify store -> go to the Apps in the left menu.

6.2. Scroll to the bottom and click on the “Manage private apps.”

6.3. Enable private app development if it was not enabled before. Select all the checkboxes and click the “Enable private app development” button.

6.4. Set “RedTrack” as an app name and place support@redtrack.io as an Emergency developer email.

6.5. Click on the “Show inactive Admin API permissions” and give “Read and write” permissions to the Orders and Script tags

6.6. Save the changes.

7. Add the scripts to your theme files.

7.1. Go to Online Store in the left menu -> Theme -> Actions -> “Edit code” 

7.2. Open theme.liquid file and add scripts to the end of <head> tag:

  • Universal tracking script (the one you have generated within step 5)
  • Events.js: <script src=”https://your.tracking.domain/events.js”></script> (replace your tracking domain part with the domain used in the Universal tracking script)
  • Order_Completed.js: <script src=”https://your.tracking.domain/order_completed.js”></script> (replace your tracking domain part with the domain used in the Universal tracking script)

Important note! If you decide to change the theme, don’t forget to add the scripts to the new theme once again.

8. Create webhooks.

8.1. Click on the Settings in the left menu -> Notifications -> Webhooks.


8.2. Go to “Create a webhook.”

8.3. Create webhooks for 2 events using the parameters below:

Event: Checkout creation; 

Format: JSON; 

URL: https://ecomappspf.redtrack.io/custom_webhooks 

Webhook API version: 2021-10 (Latest)


Event: Order creation; 

Format: JSON; 

URL: https://ecomappspf.redtrack.io/custom_webhooks 

Webhook API version: 2021-10 (Latest)

Important note!

If you use other checkout options besides standard Shopify checkout,  add the special script:

Settings -> Checkout -> Addition Scripts -> Order status page

{% if first_time_accessed %}

<script src=”https://your.tracking.domain/order_completed.js?shop={{ shop.permanent_domain }}&orderid={{ order.id }}”></script>

{% endif %}

 If you use upsell apps,  add another additional script:

Settings -> Checkout -> Addition Scripts -> Post-purchase page:

{% if first_time_accessed && !post_purchase_page_accessed %}

Universal tracking script (the one you generated on the 1.3)


(function() {

var s = document.createElement( ‘script’ );

s.setAttribute(‘src’, ‘https://your.tracking.domain/order_completed.js?shop=<storeid>.myshopify.com’);




{% endif %}

Add the Universal tracking script after the first line, replace your.tracking.domain with the tracking domain you are using for this integration, add your storeid.

9. Connect the RedTrack.io account to the Shopify Private APP.

9.1. Get your Shopify shop id.

Copy it from the URL – it is yourshopname.myshopify.com

9.2. Get your Shopify API password.

Apps -> Manage private apps -> “RedTrack” (name you gave to the app) -> copy “Password” from the Admin API section

9.3. Go to your RedTrack account -> Tools -> Integrations -> Shopify -> Add Shopify store

9.4. Add your shop id (step 9.1 ) and token (step 9.2) -> save

You are all set! Good luck!

Related Articles