Quickstart: Using Traackr Connector for Conversion Tracking

This document covers the steps required to install the Traackr Connector code on your website and start tracking affiliate link conversions in your Traackr projects.

Step 1: Add the Snippet to your Website

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),r=0;r<e;r++)n[r]=arguments[r];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/dev/js/tkrc.js");var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e)},tkrc.load()}}();
</script>

Step 2: Start Recording Conversions

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 Traackr projects' "Conversions" section.

<script type="text/javascript">
    tkrc.event('Purchase', {
        transactionId: '112-9014566-344412398',
        value: 470.01,
        valueCurrency: 'EUR',
        products: [
            {
                id: 'KS93528TUT',
                quantity: 1
            },
            {
                id: 'FT4101',
                quantity: 2
            }
        ]
    });
</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.

Step 3: Verifying Conversion Tracking

A Traackr project 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.

  1. Add an affiliate link in the project's settings with your website as the destination URL.
  2. Generate a new link using the link settings you just added for an influencer in the project. We'll be deleting this link later to remove any test data.
  3. Open the link you just generated in your browser
    1. It's important, especially if testing multiple independent snippet installations, that you visit the link in an incognito-mode browser window or clear your browser's cookies for your website before testing.
  4. If you're comfortable using your browser's developer console, you can open it now and run tkrc.getAttribution() which will display any stored affiliate link click information. Otherwise, move on to the next step.
  5. Trigger the conversion event you setup in Step 2 of this document.
  6. Within several minutes you should see this conversion appear in your Traackr project's conversions page.
  7. The link you generated for testing can now be deleted, which will remove the associated conversion event data from your project.

Appendix

Supported Conversion Event Types and Properties

Type: Purchase

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
[
    {
        "id": "KS93528TUT",
        "quantity": 1
    },
    {
        "id": "FT4101",
        "quantity": 2
    }
]