Shopify and RedTrack
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 Shopify platform was engineered for reliability and scale, making enterprise-level technology available to businesses of all sizes.
RedTrack allows you to have an API integration with Shopify. That means:
- All your conversion events are tracked on the backend automatically
- The highest level of accuracy for conversion and revenue delivery
Integration
Important before you start
Make sure you have connected the custom tracking domain to your RedTrack account.
RedTrack steps
1. Create custom conversion events.
Tools → Conversion tracking → Conversion types → add the events for Shopify (use this guide to help):
- ViewContent
- AddToCart
- InitiateCheckout
- Purchase
- Upsell
To track this event properly make sure to set up a Webhook as described later in the guide. - PartialRefund
This event is counted with a minus payout. To track this event properly set up a Webhook as well. - Refund
This event is counted with a minus payout. To track this event properly set up a Webhook. - BuyNow
This event should be applied if your page has a button “Buy Now”. - Shipping
This event type presupposes the cost of shipping minus the cost of purchase and the Payout value for this event type is counted with a minus
- Subscription
To set up this event type for Recharge subscribers refer to this article. - Recurring
To set up this event type for Recharge subscribers refer to this article.
2. Create a custom Brand.
Brands → New from scratch → use this guide to help you add your Brand
3. To send the PII data for better attribution go to the added Brand settings → Additional parameters → add the following parameters with the corresponding roles:
Parameter | Macro / Token | Name / Description | Role |
eventid | {replace} | Event ID | Event ID |
fname | {replace} | First Name | First Name |
lname | {replace} | Last Name | Last Name |
phone | {replace} | Phone | Phone |
{replace} | |||
zip | {replace} | Zip Code | Zip Code |
contentid | {replace} | Content ID | Content IDs |
content | {replace} | Content | Contents |
contenttype | {replace} | Content Category | Content Category |
4. Add your Website.
Websites → New → use this guide to help you add your website
You will need them later to connect to Shopify.
5. Create a paid traffic campaign.
The campaign for the unattributed (organic) traffic is already in place. Now you need to create the one for the paid traffic. Follow these simple steps:
- Add the Traffic channel. Most of them have a preset template in RedTrack.
- Launch a campaign for the paid Traffic channel. Your website/shop will be the main link added to the traffic channel.
Shopify steps
1. Create a custom app.
- Log in to your Shopify → Apps → Apps and sales channel settings → Develop apps for your store:
- Create an app → add the name in the App name field → choose the developer from the App developer drop-down list → Create app:
2. Configure API scopes.
2.1 Overview → Configure API scopes → Admin API access scopes → All → Order editing, Orders, Script tags → tick the following boxes next to them:
Order editing: write, read
Orders: write, read
Script tags: write, read
2.2 In the Selected tab you can re-check if everything was added. Save the changes and install the app.
3. Reveal the token.
Reveal token once → save it
Connection steps
1. Connect your RedTrack account to the Shopify Private App
Tools → Integrations → Shopify → Add Shopify store → add your shop id and token
- Shop id: copy it from the URL, it is yourshopname.myshopify.com.
- Token: Shopify token you got during the private app creation.
2. Add the needed scripts:
- To find the scripts go to Website→Scripts:
In case you don’t have the generated scripts in your account, copy them from the templates below, but remember to replace yourcustom.tracking.domain with your actual custom tracking domain:
- Universal tracking script
- Web events tracking Events.js:
<script src="https://yourcustom.tracking.domain/events.js"></script>
{% if first_time_accessed && !post_purchase_page_accessed %} <script src="https://yourcustom.tracking.domain/order_completed.js?shop={{ shop.permanent_domain }}&orderid={{ order.id }}"></script> {% endif %}
- Universal tracking script
- Upsell Tracking script:
<script> (function() {
var s = document.createElement( 'script' );
s.setAttribute('src', 'https://yourcustom.tracking.domain/order_completed.js?shop=<shop_id>.myshopify.com');
document.body.appendChild(s);
})();
</script>
- To add the scripts act as follows depending on the script type:
1. Online Store → Themes → Actions → Edit code:
2. Copy the Universal tracking script and Web events tracking Events.js from RedTrack Website settings (or template) → Layout → theme.liquid → add the copied scripts to the end of the <head> tag:
To set it up in RedTrack copy the Custom checkout tracking script from the Website settings (or template) → in Shopify go to Settings → Checkout and accounts → Order status page → Additional scripts → Custom checkout tracking:
To set it up:
1. In RedTrack copy the Universal tracking script & Upsell Tracking from the Website settings (or template) → in Shopify go to Settings → Checkout and accounts → Post-purchase page → Additional scripts → add the scripts from RedTrack:
2. Replace the store ID in the Upsell Tracking with your store:
3. Create Webhooks.
Settings → Notifications → Webhooks → Create webhook:
Checkout creation – mandatory.
Order creation – mandatory.
Order edit – optional. Add it if you need to track the Upsell events.
Refund create – optional. Add it if you need to track such events as Partial Refund and/or Refund.
- Event: Checkout creation
- Format: JSON
- URL: https://ecomappspf.redtrack.io/custom_webhooks
- Event: Order creation
- Format: JSON
- URL: https://ecomappspf.redtrack.io/custom_webhooks
Order edit webhook should be added only for Upsell event tracking.
- Event: Order edit
- Format: JSON
- URL: https://ecomappspf.redtrack.io/custom_webhooks
- Event: Refund create
- Format: JSON
- URL: https://ecomappspf.redtrack.io/custom_webhooks
▸ If you want to track manually added orders in Shopify with RedTrack, refer to this article for additional setup steps.
▸ If your Shopify store domain or/and custom tracking domain were changed you must update these domains in RedTrack and/or Shopify for correct tracking. Refer to this article for additional setup steps.
▸ If you use a landing page before the shop, plus the landing page and Shopify shop domains are different, refer to this article for setup.