Find and Use the URID for JavaScript

Important Notes:

“mm_urid” is used in the examples below. If you have defined your own variable, please change ALL “mm_urid” references to the variable name you selected when setting up the click URL.

You must replace the default Goal ID (“12345”) with the App Tracking ID given to you by your Account Manager or when you registered on mMedia.

Don’t have an App Tracking ID? Do one of the following:

Step 1: Insert the following into the <head> of all HTML pages in the conversion tracking flow except the “thank you” page.

...
<script type="text/javascript">
//<![CDATA[

var expected_param_name="mm_urid";
var goal_id = "12345";

var urid="";
var rurid=document.location.href;
var i = rurid.indexOf("?" + expected_param_name + "=");
if ( i < 0 ) { i = rurid.indexOf("&" + expected_param_name + "="); }
if ( i >= 0 ) {  urid=rurid.substr( i + expected_param_name.length + 2, 24 ); }
if ( urid.indexOf("&") > 0 || urid.length != 24 ) urid="";
//]]-->
</script>
...
...
<script type="text/javascript">
//<![CDATA[
var linkstring = "nextpage.html";
var linktext = "Next Page";

if ( urid != "" ) { linkstring = linkstring + "?" + expected_param_name + "=" + urid; }
document.write("<a href=\"" + linkstring + "\">" + linktext + "</a>" );
//]]-->
</script>
...

Step 3: On the final page following the conversion activity, include this in the <head> (instead of the code in Step 1).

...
<script type="text/javascript">
//<![CDATA[

var expected_param_name="mm_urid";
var goal_id = "12345";

var urid="";
var rurid=document.location.href;
var i = rurid.indexOf("?" + expected_param_name + "=");
if ( i < 0 ) { i = rurid.indexOf("&" + expected_param_name + "="); }
if ( i >= 0 ) {  urid=rurid.substr( i + expected_param_name.length + 2, 24 ); }
if ( urid.indexOf("&") > 0 || urid.length != 24 ) urid="";


document.getElementById('cvt').innerHTML = "<img src=\"http://cvt.mydas.mobi/handleConversion?goalId=" + goal_id + "&urid=" + urid + "\"/>";

//]]-->
</script>
...

Include the following somewhere in the <body>:

...
<div id="cvt" style="display:none"> </div>
...