Welcome!
Welcome to the Marin Software Support Center. We're glad you're here. Here's what you can look forward to:
  • Real-time search so you can find what you need faster than ever.
  • Easy-to-follow video guides for our most popular articles.
  • Interactive simulations and Live Screenshots to make learning easy.
  • Regular content updates to ensure every word you read is accurate and up-to-date.

Revenue and Conversion Tracking

Home > English > Revenue and Conversion Tracking > Revenue Upload > How To Articles: Revenue Upload > Understanding the Legacy (Synchronous) Revenue Tracking Code Snippet

Understanding the Legacy (Synchronous) Revenue Tracking Code Snippet

Introduction

Although the revenue tracking snippets have been updated in the platform, the legacy revenue tracking snippets as seen in this article still work, and they are also compatible with the updated snippets. Please refer to the following Help article for more information on the updated revenue tracking snippets: Revenue & Conversion Tracking - How to View the Tracking Pixel Code Snippet.

Setting up the legacy revenue tracking involves placing a small snippet of JavaScript code in the footer of all pages of your web site. Additionally, a hidden data field is also included on the conversion thank-you page. These elements track the source of a click from the publisher through conversion.

Here’s how to find the snippets:

  1. Go to the Admin section of the platform, then click on the Revenue tab and finally Revenue Tracking in the left-hand menu.
  2. Ensure that the Use platform tracking checkbox is checked.
  3. Select the appropriate security setting for your web site: either http: or https:
  4. You will then see the two code snippets you’ll need. Let’s look at these in more detail.

The landing page snippet

The first snippet of code needs to be placed on all landing pages in your web site. This code captures the source of the click (specifically, the keyword ID). It should be placed in the footer, just before the </html> tag. Here's the code:
 

<!-- begin Marin Software Tracking Script -->
<script type='text/javascript'>
var _marinClientId = "7gsv027b70";
var _marinProto = (("https:" == document.location.protocol) ? "https://" : "http://");
document.write(unescape("%3Cscript src='" + _marinProto + "tracker.marinsm.com/tracker/" +
_marinClientId + ".js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type='text/javascript'>
try {
_marinTrack.trackPage();
} catch(err) {}
</script>
<noscript>
<img src="https://tracker.marinsm.com/tp?act=1...7b70&script=no" >
</noscript>
<!-- end Copyright Marin Software -->

Understanding the landing page snippet

This section of the code sets the protocol of page (http or https) and loads the relevant JavaScript:
 

var _marinClientId = '7gsv027b70'; [ client ID ]
var _marinProto = (("https:" == document.location.protocol) ? "https://" : "http://");


This code examines the page and sets the appropriate cookies:
 

try {
_marinTrack.trackPage();


This noscript tag is used to catch browsers that do not support JavaScript:
 

<noscript>
<img src="https://tracker.marinsm.com/tp?act=1...7b70&script=no" >
</noscript>

The ‘Thank You’ page snippet

The second snippet is similar to the landing page code but is preceded by information about the purchase. This form + code content needs to be placed on the confirmation or thank you page that is displayed after a customer has converted on your website. This code sends the details associated with the conversion.

It is preceded by a hidden form which contains the purchase information:
 

<form style='display:none;' name='utmform'>
<textarea id='utmtrans'>
UTM:T|<order-id>|<affiliation>|<total>|<tax>|<shipping>|<city>|<state>|<country>
UTM:I|<order-id>|Purchase|<ProductName>|<category>|<price>|<qty>

</textarea>
</form>


The conversion type for this confirmation snippet would be inserted after the second pipe in the UTM:I line (in the above example, this would be for the "Purchase" conversion type). Please note that the UTM:T and UTM:I values within the angle brackets < > would be dynamically populated values, which should be inserted server-side directly into the pixel.

And here is the code snippet:
 

<!-- begin Marin Software Tracking Script -->
<script type='text/javascript'>
var _marinClientId = "6w1k7qwbc0";
var _marinProto = (("https:" == document.location.protocol) ? "https://" : "http://");
document.write(unescape("%3Cscript src='" + _marinProto + "tracker.marinsm.com/tracker/" +
_marinClientId + ".js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type='text/javascript'>
try {
_marinTrack.processOrders();
} catch(err) {}
</script>
<noscript>
<img src="https://tracker.marinsm.com/tp?act=2...ate|country%0A" />
</noscript>
<!-- end Copyright Marin Software -->

Understanding the ‘thank you’ page snippet

The optional UTM:T line in the hidden form provides information about the order total. The optional UTM:I lineprovides information about individual items in the order. If included, it should be repeated once for each line item in the order. Within each line, all of the additional variables are optional, however, in order to correctly parse the results, all of the | (pipe) delimiters must be included.

As an example, for tracking the order total only, the code should read:
 

<form style="display:none;" name="utmform">
<textarea id="utmtrans">
UTM:T|||XX.XX|||||
</textarea>
</form>


For conversion tracking only, the code should read:
 

<form style="display:none;" name="utmform">
<textarea id="utmtrans">
UTM:T||||||||
</textarea>
</form>


Note: If using multiple currencies, add the following code and replace the value of the currency parameter with the appropriate ISO currency code. (For example, if orders are placed in Pounds or Dollars, for each transaction pass the appropriate currency value – currency : ‘GBP’ OR currency : ‘USD’).
 

<script type='text/javascript'>
var _marinClientId = '6w1k7qwbc0';
var _marinTransaction = {
currency : ‘USD’
};
var _marinProto = (("https:" == document.location.protocol) ? "https://" : "http://");

The revenue tracker can be tested using the link at the bottom of this page. Once revenue tracking has been set up, this utility will show the last hour or last 24 hours (capped at 1,000 rows) of tracker data.

Additional information about revenue tracking

  • It’s possible to track multiple conversion types using the platform tracking pixel and the above code. 
  • If you're using the platform tracking pixel, the settings in the Conversion Types page within the Revenue tab of the Admin section that specify whether conversion types are included in totals columns do not necessarily reflect your actual setup. This is actually dictated by whether or not you use the UTM:T line on the confirmation page for that particular conversion type. The only exception to this is if you have conversion types that never use the UTM:T line, and hence don't include revenue.

How to check if the snippet has been implemented correctly

There may be times that you see no conversions in the platform, even though conversion tracking is set up. There are a number of different issues that can cause this, but in the first instance you should check that your tracking code snippet is implemented properly. Here’s how to do that:

Landing page snippet  

  1. Click on any Destination URL within the platform to go to your landing page.
     
  2. View the source code of that page. For most modern browsers, pressing CTRL & U will accomplish this.
     
  3. Look for the platform tracking code within the page’s source code. Remember, you can find out what to look for from the Revenue Settings page.
     
  4. Compare your tracking script to the template script seen in the application, which should look similar. For example, the var _marinClientId value should match with what is written in the application template.

'Thank you' page snippet  

  1. Complete a conversion on your site.
     
  2. When you are taken to the "Thank You" confirmation page, view the source code here.
     
  3. Look for the platform tracking code within the page's source code.
     
  4. Compare your tracking script to the template script seen in the application, which should look similar. For example, the line _marinTrack.processOrders(); should match exactly in your snippet as seen written in the application template.
     

Important note about the 'Thank you' snippet

You cannot have an HTML <form> (ie. the tracker 'Thank You' page snippet form) within another HTML <form>. If this is the case, it will cause the script to break and not capture conversions. A workaround for this is to just use the tracker image pixel. In this case, the tracker script on your 'Thank You' page would look similar to the following:
 

<!-- begin Marin Software Tracking Script -->
<img width="1" height="1" src="https://tracker.marinsm.com/tp?act=2&cid=<tracker-id>&currency=<currency-iso-code>&trans=UTM:T|<order-id>|<name>|<total>|<address>|<city>|<state>||%0AUTM:I|<order-id>|<conversion-type-id>|<sku>|<category>|<price>|<qty>" />
<!-- end Copyright Marin Software -->

 

Please note the following:
 
  • Make sure there are no commas included in the dynamically inserted values in the conversion code (ie. 1,000). Commas will break the code so please exclude this from the logic.
  • Values within the < > brackets are currently just place holders, in which you would replace these with actual values (make sure the actual values do not still include brackets)
  • If you do not wish to populate any of the values within the < > brackets after the UTM:T and UTM:I lines, then this bracketed placeholder can be removed (so that only the pipes | remain).
  • the <tracker-id> is the alphaneumeric value found in Admin > Revenue tab > Revenue Tracking > click the Platform Tracker: "Go to Tracker Setup Page" > In the Landing Page Code section click Show Snippet. The <tracker-id> value will be the value within the quotes for the var mClientID field.
  • the <conversion-type-id> is where you specify which conversion this image pixel corresponds to. This ID can be found in Admin > Revenue tab > Conversion Types > ID column

Important notes

  • Please make sure there is no more than one pixel per conversion page. This is because multiple conversion pixels on the same page might cause duplicated conversions.

 

 

Last modified

Tags

Classifications

This page has no classifications.

 

wiki.page("Internal/Mindtouch_Launch_Sandbox/js.cookie.js")