Offer sources integrated via API

Shopify Private App integration

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

Settings on the RedTrack’s side

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

1.1. Create a custom Offer Source

Expand to see how to add a custom Offer source

1.1.1 go to 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 a 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. 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

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

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 Offer

Expand to see how to add your Offer

Offer is basically your shop’s URL. To add one go to Offers -> New and add your Offer:

 

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’ll need to use, but you can add other events you may need:

  • 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 firts 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 Sources-> 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 -> on the main menu navigate to the Apps section:

6.2 Scroll down to the bottom and click on the option Develop apps for your store:

6.3 In the top right corner press Create an app:

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

6.5 Under the Overview tab press Configure API scopes:

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

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

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

6.9 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.9) -> 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 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.

 

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 a webhook:

9.3 Create webhooks for 2 events using the parameters below and press Save:

Event: Checkout creation; 

Format: JSON; 

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

Webhook API version: 2022-01 (Latest)

 

Event: Order creation;

Format: JSON; 

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

Webhook API version: 2022-01 (Latest)

9.4. Important supplement!

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.

To do that:

9.4.1 go to Settings:

9.4.2 navigate to the Checkout section:

 

9.4.3 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://<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)

 


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