Traackr helps you drive sales with your influencers. To enable conversion tracking, you first need to install the Traackr Connector code on your website. Once connected you will be able to track the conversions and revenue that come from your influencers' tracking links.
Different ecommerce stores and websites have different steps for conversion tracking. This document covers a few different ways to install the Traackr Connector code on your website and start tracking link conversions and sales generated from your influencer marketing campaigns in Traackr.
The Traackr Connector code can be installed on any ecommerce site via a custom integration.
Copy the snippet below and paste it into the <head>
tag of your site.
<script type="text/javascript">
!function(){window.tkrc=window.tkrc||[];var tkrc=window.tkrc;if(!tkrc.initialize)if(tkrc.invoked)window.console&&console.error;else{tkrc.invoked=!0,tkrc.methods=["event"],tkrc.factory=function(t){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return n.unshift(t),tkrc.push(n),tkrc}};for(var t=0;t<tkrc.methods.length;t++){var e=tkrc.methods[t];tkrc[e]=tkrc.factory(e)}tkrc.load=function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="".concat("https://cdn.tkrconnector.com/js/tkrc.js");var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e)},tkrc.options={},tkrc.load()}}();
</script>
Depending on how your website is setup additional configuration options may be required.
If your website uses multiple subdomains for the conversion flow you must configure the cookieβs domain.
In your snippet, update tkrc.options={}
to include a cookieDomain
property set to your root domain.
For example, if your links are for www.example.com
, which has a checkout process that happens at checkout.example.com
, then example.com
should be used for the cookieDomain
value:
tkrc.options={
cookieDomain: 'example.com'
}
With the snippet installed you can start recording conversion events on your site.
To track a conversion, call the tkrc.event()
method. For example, on a checkout
success page you could add the following to the <body>
tag on the page:
<script type="text/javascript">
tkrc.event('Purchase');
</script>
This is the simplest conversion event, including only the conversion type: "Purchase". More details can be provided for conversion events. These details will be visible within your campaign's "Conversions" section in the Traackr platform.
<script type="text/javascript">
tkrc.event('Purchase', {
transactionId: YOUR_TRANSACTION_ID,
value: YOUR_PURCHASE_VALUE,
valueCurrency: YOUR_PURCHASE_CURRENCY_CODE,
products: [
{
id: YOUR_PRODUCT_ID_OR_NAME,
quantity: YOUR_QUANTITY_SOLD
},
{
id: YOUR_PRODUCT_ID_OR_NAME,
quantity: YOUR_QUANTITY_SOLD
}
],
promoCode: YOUR_PROMO_CODE, // optional
clientId: TRAACKR_CLIENT_ID // required if promoCode is set.
});
</script>
Note: If you are using percent-based commissions, the value
and
valueCurrency
properties are required for influencers to receive a commission
on the conversion.
The full list of supported conversion event properties is in the appendix at the end of this document.
From the Shopify Admin page, navigate to Online Store -> Themes
Click the Actions menu for your current theme, then click Edit code
In the Layout folder, click theme.liquid
Paste the code snippet inside the <head>
section of the code
From the Shopify Admin page, navigate to Settings -> Checkout
Scroll down to the Additional Scripts section, where you should see a box for Order Status Page
Paste the code snippet in this box as well, followed by the purchase event code. The purchase event code can make use of the Shopify order data using their Liquid tags, e.g.
<script type="text/javascript"></script>
Note: The code snippet needs to be included in this Additional Scripts box because theme.liquid
does not apply to the Checkout page, so the snippet would not otherwise be loaded on the checkout page. With a Shopify Plus plan, it is possible to customize the checkout page theme and avoid loading the script here, but it's not recommended as any automatic updates won't apply to a customized checkout theme. See Checkout Liquid Theme for more info.
Conversion tracking should now be enabled! You can enable Test Mode in Shopify to test out the integration without submitting real transactions. See Testing Shopify Payments.
The Traackr Connector code can be installed using the Google Tag Manager for more centralized management of your website's installed scripts. For non-natively integrated ecommerce sites GTM may be your primary way of installing scripts.
HTML
All Pages - Page View
trigger. This will ensure the snippet is loaded on every page of the site that this Google Tag Manager container is installed on.SNIPPET_TAG_NAME
fires', then select the snippet tag. Also, check the box that prevents the tag from firing if the snippet tag doesn't load. This will ensure the snippet tag is loaded before attempting to fire any events. You can also achieve this behavior using Prioritization.
<script type="text/javascript"></script>
Note: `products` (if included) must be an array of objects, with each object representing one product.
<script type="text/javascript">
tkrc.event('Purchase');
</script>
A Traackr campaign with link tracking and conversions enabled can be used to test that conversion events are correctly recorded from your website. This could be an existing project or a new temporary one created just for testing.
tkrc.getAttribution()
which will display any stored affiliate
link click information. Otherwise, move on to the next step.There are a number of things that will determine whether or not Traackr Connector has been properly integrated into your e-commerce workflow. Here are some things to check:
The Traackr Connector code snippet should be included on every page of your website. You can verify that the Traackr Connector script is being loaded by opening your by opening the network tab in your browser's devtools, reloading the page, and making sure that the tkrc.js
script is found with a 200
status. Common issues include:
example.com
instead of shop.example.com
, otherwise your events may not fire due to missing cookie data.When the purchase event is correctly integrated, you should see a successful network request to api.tkrconnector.com/e
being made by the browser. If this is not occurring then consider the following:
tkrc is not defined
, which indicates that the Traackr Connector library is not loaded on the page where you're attempting to fire tkrc.event()
. The code snippet must be loaded BEFORE attempting to fire an event via tkrc.event
. If using Google Tag Manager, ensure the tag that loads the Traackr Connector script has a higher firing priority than the event tag, or makes use of Tag Sequencing to ensure the proper firing order.tkrc.event()
on the page, and should investigate your code to find out why.Property | Data Type | Description | Example |
transactionId |
string | A unique transaction ID, such as an order confirmation number. | "112-9014566-344412398" |
value |
number | A non-negative decimal monetary value. | 1099.53 |
valueCurrency |
string |
The three-letter iso-4217 currency code of the value field.
If value is provided, this field is required.
|
"EUR" |
products |
Object[] |
An array of JSON objects with information about products associated with the conversion.
The supported keys are id , and quantity |
|
promoCode |
String | A string representing a promoCode |
|
clientID |
string |
A string representing the clientId which uniquely identifies your account. If this is not set, the promoCodes are ignored.
If you donβt have your Client ID, ask your Traackr Account Representative. |
|