E-com

Shopify Private App

Shopify: general overview

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

Settings on the RedTrack’s side

1. Add your shop to RedTrack.io. To do that:

1.1. Create a custom Brand

Expand to see how to add a custom Offer source

1.1.1 go to Brands (offer sources) -> press New from scratch and give your offer source a name:

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

1.1.2 if you work with Facebook, and want to send the PII data for better attribution, in the Offer source window scroll down to the Additional parameters section to add postback parameters and assign relevant roles to each of them. Once it’s done, press Save:

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 Event ID

fname = {replace}  add/assign role First Name

lname = {replace}  add/assign role Last Name 

phone = {replace} add/assign role Phone

gender = {replace} add/assign role Gender

email = {replace} add/assign role Email

zip = {replace} add/assign role Zip Code

birthday = {replace} add/assign role Birthday

сontentid = {replace} add/assign role Content IDs

contents = {replace} add/assign role Contents

contenttype = {replace} add/assign role Content Category

сontent = {replace}  add/assign role Content Name

Make sure this data is available on your side. If not, don’t worry, RedTrack will still send as much data to Facebook as possible.

 

1.2 Add your Website. Use this article to help you.

 

2. Create custom conversion events

Expand to see how to create conversion events

2.1 Go to Tools -> Conversion tracking -> Conversion types -> if needed, add types in 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 are to use, but you can add other events if needed:

  • ViewContent
  • AddToCart
  • InitiateCheckout
  • Purchase
  • Upsell

 

3. Add a custom tracking domain

Useful!

Check out the video tutorial as well: Adding a custom tracking domain.

4. Create tracking campaigns in RedTrack

Important!

Scenarios for your tracking Campaigns in RedTrack may be as follows:

Scenario 1: only unattributed (aka organic) traffic. In which case, one Campaign for your unattributed (aka organic) source is enough.

Scenario 2: several paid Traffic sources (like Facebook or Google or something else) and unattributed (aka organic) traffic. In which case it is crucially important to add these Traffic sources first and then create a Campaign for each source. This will help you to have all the important data in place and grouped correctly.

Expand to see how to act depending on the scenario

4.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.

4.2 Add the traffic source for unattributed (aka organic) traffic. To do that:

4.2.1 go to Traffic channels-> New from template-> add the template named Other:

4.2.2 add the name “Other” or “Organic” or anything else you’d like in the Source name field in order to identify the unattributed traffic from other paid traffic sources:

 

4.3 Create campaigns with each of your sources or traffic. For example, if you have Facebook and organic (the one created in step 4.2), you should create 2 campaigns.

Important!

In most cases your online shop will act as an Offer, so your Сampaigns will have only this Offer in the Funnel:

 

5. Generate a Universal Tracking Script.

Settings on Shopify’s side

6. Create a Custom app.

Expand to see how to create a Custom app

6.1 Login to your Shopify store -> go to the Apps section->navigate to the pop-up option Apps and sales channel settings->Develop apps for your store:

   

6.2 In the top right corner press Create an app:

6.3 Type in the name in the App name field -> choose the developer from the App developer drop-down list -> press Create app:

6.4 Under the Overview tab press Configure API scopes:

6.5 In the “Admin API access scopes” window under the “All” tab scroll down to the scopes named Order editing, Orders, Script tags -> tick the boxes next to them:

6.6 Check in the Selected tab if the right values were selected and if so press Save:

6.7 Once the configuration is saved, press the Install app button in the top right corner:

6.8 Once you’ve installed the app, you will be able to reveal your token

Important!

A warning message will pop up informing you that the access token can only be viewed once and will be revealed to you once you press Install:

When you are ready, press Reveal token once and save it for yourself, as you will need to apply it in step 7.3 below:

 

Connecting the RedTrack.io account to the Shopify Private APP

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

Expand to see how to connect RT to Shopify App

7.1 Get your Shopify shop id

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

7.2 Go to your RedTrack account -> Tools -> Integrations -> Shopify -> Add Shopify store:

7.3 Add your shop id (step 7.1 ) and token (step 6.8) -> Save:

 

8. Add the scripts to your theme files

Expand to see how to add the scripts to the theme files

8.1 On the main menu navigate to the Online Store section -> Themes -> Actions -> Edit code:

8.2 Open the theme.liquid file:

8.3 Add two scripts to the end of the <head> tag:

  • Universal tracking script (the one you generated within step 5)
  • Events.js:
    <script src="https://your.tracking.domain/events.js"></script>

    (in the script above replace the your.tracking.domain part with the domain you used in the Universal tracking script)

Important note! If you decide to change the theme, remember to add the scripts to the new theme once again.

 

9. Create webhooks

Expand to see how to create webhooks

9.1 Click on Settings in the left bottom corner -> choose the option Notifications:

9.2 Scroll down to the section Webhooks and press Create webhook:

9.3 Create webhooks for 2 events (“Checkout creation” and “Order creation“) using the parameters below and press Save:

Values to be inserted in the “Checkout creation” webhook:

  • Event: Checkout creation;
  • Format: JSON
  • URL: https://ecomappspf.redtrack.io/custom_webhooks
  • Webhook API version: 2023-01 (Latest). It is crucially important for you to choose the latest version of Webhook API from the dropdown. Usually the latest Webhook API version is marked with the current year and the word (Latest) at the end:

How your webhook will look like once the values are filled in:

 

Values to be inserted in the “Order creation” webhook:

  • Event: Order creation;
  • Format: JSON
  • URL: https://ecomappspf.redtrack.io/custom_webhooks
  • Webhook API version: 2023-01 (Latest). It is crucially important for you to choose the latest version of Webhook API from the dropdown. Usually the latest Webhook API version is marked with the current year and the word (Latest) at the end:

How your webhook will look like once the values are filled in:

 

10. Add additional scripts

Expand to see how to add additional scripts

If you use other checkout options besides standard Shopify checkout, add special additional scripts to your Order status page and Post-purchase page in case you use upsell apps. Without these scripts you may face cost discrepancies. 

To add the scripts act as follows:

10.1 go to Settings-> navigate to the Chekout and accounts section:

 

10.2 scroll down to the end of the page and insert the following scripts:

      ✓ to Order status page in the Additional scripts field:

script for copypasting:

{% if first_time_accessed && !post_purchase_page_accessed %}
<script src="https://your.tracking.domain/order_completed.js?shop={{ shop.permanent_domain }}&orderid={{ order.id }}"></script>
{% endif %}

       ✓ to Post-purchase page in the Additional scripts in case you use upsell apps:

script for copypasting:

Universal tracking script 
<script> (function() { 
var s = document.createElement( 'script' ); 
s.setAttribute('src', 'https://<your.tracking.domain>/order_completed.js?shop=<shop_id>.myshopify.com');
document.body.appendChild(s);
})();
</script>

Note! Mind the following in the inserted script (all the hints on the screenshot above):

  • Add the Universal tracking script after the first line (the one you have generated within point 5 of this guide)
  • Replace your.tracking.domain with the tracking domain you are using for this integration
  • Add your store id (shop=yourstore.myshopify.com)

 

11. (optional) For additional setup within the case where the landing page (aka website) domain and the Shopify shop domain are different domains, click here.

Important!

In case you changed your Shopify store domain or/and custom tracking domain, you must change the domains within your Shopify↔RedTrack integration.

 

Expand to see where the domains should be replaced

When you change the domain name of your Shopify store, remember to do the following:

 

On the RedTrack side:

 

1. Replace the old Offer URL added within step 1.2 with a new one:

 

2. If you work with Facebook, then you should also replace the old Default event URL with a new one (Web-sites-> edit your Offer-> scroll down to the FB part) and make sure it's verified on the FB side:

 

On the Shopify side:

 

3. Replace manually old cookie domain with the new one in the universal tracking script added to theme liquid step 8.3:

 

4. Replace manually old cookie domain with the new one in the universal tracking script added to the Post-purchase page within step 10.2:

When you change the name of the custom tracking domain, do the following:

 

1. Replace the outdated custom tracking domain with an updated one in the universal tracking script and Events.js script added to theme liquid within step 8.3:

 

2. Replace the outdated custom tracking domain with a valid custom tracking domain in the additional scripts added within step 10.2 (Order status page and Post-purchase page scripts):

 

Note!

If you add some orders to your Shopify store manually and want them to be displayed in RedTrack, please turn to support@redtrack.io for additional assistance.

 


If you still experience any issues or questions with the RedTrack-Shopify integration check out our video turorial:

You are all set! Good luck!

Related Articles