Login to your Miva5 admin panel. Go Left menu->Pages. Now click edit on INVC Invoice page.
Now paste sale tracking code to textarea named Template, just after row that contains text <mvt:item name="body">:
Example:
<mvt:item name="html_profile" />
<head>
<title>&mvt:store:name;: Invoice</title>
<base href="&mvt:global:basehref;">
<mvt:item name="head" param="head_tag" />
</head>
<mvt:item name="body">
<mvt:item name="mslscb" param="invc" />
<mvt:item name="hdft" param="global_header" />
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="bottom">
<mvt:item name="navbar" />
</td>
</tr>
...
Now we add sale tracking code:
<mvt:item name="html_profile" />
<head>
<title>&mvt:store:name;: Invoice</title>
<base href="&mvt:global:basehref;">
<mvt:item name="head" param="head_tag" />
</head>
<mvt:item name="body">
<script type="text/javascript">
document.write(unescape("%3Cscript id=%27pap_x2s6df8d%27 src=%27" + (("https:" == document.location.protocol) ? "https://" : "http://") + "www.yoursite.com/affiliate/scripts/trackjs.js%27 type=%27text/javascript%27%3E%3C/script%3E"));
</script>
<script type="text/javascript">
function stringFilter (s) {
filteredValues = "1234567890.,";
var i; var returnString = "";
for (i = 0; i < s.length; i++) {
var c = s.charAt(i);
if (filteredValues.indexOf(c) != -1) {
returnString = "" + returnString + "" + c;
}
}
return returnString;
}
var counter = 0;
var sales = new Array();
PostAffTracker.setAccountId('default1');
<mvt:foreach iterator="item" array="order:items">
sales[counter] = PostAffTracker.createSale();
sales[counter].setTotalCost(stringFilter(' &mvt:item:formatted_subtotal;'));
sales[counter].setOrderID(' &mvt:order:id;'.substr(1));
sales[counter].setProductID(' &mvt:item:code;'.substr(1));
counter ++;
</mvt:foreach> PostAffTracker.register();
</script>
<mvt:item name="mslscb" param="invc" />
<mvt:item name="hdft" param="global_header" />
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="bottom">
<mvt:item name="navbar" />
</td>
</tr>
...
Thats it. Now you can track your sales.
Note: Every produt is tracked as single transaction. For
every product in customer basket we record its
price,
code and
orderId from your Miva5 store.
If you want to add additional fields read this
Miva5 template technical documentation.