Variable Visions

Articles E-commerce ONLINE-CONVERSIONS-TRACKING-THE-ORIGINS


tutorials - E-commerce and Web-Development.

ONLINE CONVERSIONS: TRACKING THE ORIGINS

Published Wed. Jul. 10, 2013


The obvious main goal for an ecommerce web site is to sell something.  A conversion….an online purchase…each of which has a history. How did the customer find your web store? Direct Traffic, organic search listings, or from a Pay Per click advertisement. If the latter is the origin or referrer, we as web developers and SEO/PPC professionals like to track the sources of which the sale was initially attributed to.

Both Google and Bing/Yahoo ad networks have conversion code to place on the “thank you for ordering” page of your web store. Once an item is ordered, the scripts on the conversion page are sent to Google, Bing/Yahoo, or both, to start recording data in their respective AdWords/AdGroups/AdCampaigns.

WARNING: Some conversion codes are ok in the head tag, while others NEED to be in the body tag. I discovered this when the Bing/Yahoo Conversion code was throwing a console error after one of my test orders. The same code in the body tag eliminated the console error.

The provided code from both Google and Yahoo are great for simply collecting if a conversion occurred and attribute it to an ad/group/campaign. BUT, what if you want to actually do some ROI testing? I’ve said this many times to bosses/co-workers “Without conversions AND REVENUE data being collected in our ad networks, we can not truly gauge the effectiveness of a campaign and control spending and/or increase performance”.

Once the conversion and revenue data are being collected, we can go through daily/weekly/monthly reports to analyze the ROI. Basically we want to see the revenue outweigh the spend.  I have seen campaigns that are worked and bids raised and lowered without the conversion or revenue data present. How can we do that? Based on “I think I’m spending too much today/this month” or I think I’ll spend some more to get a better placement vs. my competitor”? This is what they WANT you to do….Ever wonder why when you create new keywords, either in the editor software or via the web front end, the match type is broad? Cause you’ll spend more that way.  Just like you will spend like crazy on the terrible “suggested” keywords they advise you to bid on. Broad and Phrase match types when done right are great, but without the proper list of negative keywords, irrelevant searched will be made, clicked, and money flushed. Exacts are more effective but more rare. Broad and Phrases are very versatile and you can omit irrelevant traffic, either before or after the queries are made.

Now we can really know if six bucks a click is worth it. Or if spending two grand a month is too little or not enough. If you are spending on ads that don’t convert… stop. Or alter the display ad/item price. If you see ads or keywords that have great conversion rates, put more money into those.  And use the same keyword in different match types to gain the most cost effective conversion.

If done right, these campaigns can drive the large majority of your online sales. If your online store is making money, you can spend. Large or small scale the concept is the same. I’ve setup and handled campaigns that spend $100 a month and some that spend $10K a month. You better be selling a lot of goods to justify that cost…and be able to truly track the conversions from paid ads.

It gets even more interesting if you accept orders via phone. I’ve seen many sales over the phone that can be directly attributed to a paid ad. Tracking those are another story.

 

Here is the code: Mind you, I work with NetSuite as my web store. Other systems have different revenue variables.

 

 

STANDARD BING/YAHOO CONVERSION SCRIPT

<script type="text/javascript"> if (!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};</script> <script id="mstag_tops" type="text/javascript" src="//flex.msn.com/mstag/site/315f529b-8c38-45e7-972e-e32354a4941f/mstag.js"></script> <script type="text/javascript"> mstag.loadTag("analytics", {dedup:"1",domainId:"XXX",type:"1",revenue:"",actionid:"XXX"})</script> <noscript> <iframe src="//flex.msn.com/mstag/tag/315f529b-8c38-45e7-972e-e32354a4941f/analytics.html?dedup=1&domainId=XXX&type=1&revenue=&actionid=XXX" frameborder="0" scrolling="no" width="1" height="1" style="visibility:hidden;display:none"> </iframe> </noscript>

BING/YAHOO CONVERSION SCRIPT WITH NETSUITE REVENUE VARIABLE INSERTED

<script type="text/javascript"> if (!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};</script> <script id="mstag_tops" type="text/javascript" src="//flex.msn.com/mstag/site/315f529b-8c38-45e7-972e-e32354a4941f/mstag.js"></script> <script type="text/javascript"> mstag.loadTag("analytics", {dedup:"1",domainId:"XXX",type:"1",revenue:"<%=getCurrentAttribute('confirmation','subtotal')%>",actionid:"XXX"})</script> <noscript> <iframe src="//flex.msn.com/mstag/tag/315f529b-8c38-45e7-972e-e32354a4941f/analytics.html?dedup=1&domainId=XXX&type=1&revenue=<%=getCurrentAttribute('confirmation','subtotal')%>&actionid=XXX" frameborder="0" scrolling="no" width="1" height="1" style="visibility:hidden;display:none"> </iframe> </noscript>

 

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

GOOGLE CONVERSION CODE – ANALYTICS

<script type="text/javascript">

                var _gaq = _gaq || [];

  _gaq.push(['_setAccount', 'UA-XXX]);

  _gaq.push(['_setDomainName', 'none']);

  _gaq.push(['_setAllowLinker', true]);

 

 _gaq.push(['_addTrans',    

   "<%=getCurrentAttribute('confirmation','ordernumber')%>",          

   "<%=getCurrentAttribute('site','name')%>", 

   "<%=getCurrentAttribute('confirmation','subtotal')%>",         

   "<%=getCurrentAttribute('confirmation','tax')%>",          

   "<%=getCurrentAttribute('confirmation','shipping')%>",    

   "<%=getCurrentAttribute('confirmation','shiptocity')%>",   

   "<%=getCurrentAttribute('confirmation','shiptostate')%>",     

   "<%=getCurrentAttribute('confirmation','shiptocountry')%>"]);   

 

 var itemsInOrder = "<%=getCurrentAttribute('confirmation','orderitems')%>";

 

 var lineItem = itemsInOrder.split("||");

 

 for(var inum = 0; inum < lineItem.length; inum++)

 {

 var itemAttributes = lineItem[inum].split("|");

 _gaq.push(['_addItem',

                                                "<%=getCurrentAttribute('confirmation','ordernumber')%>",    

                                                itemAttributes[0],          

                                                itemAttributes[1],           

                                                itemAttributes[2],       

                                                itemAttributes[3],  

                                                itemAttributes[4]]);

                }

                _gaq.push(['_trackTrans']);

 

(function() {

    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

  })();     

</script>

 

 

 

 

<script type="text/javascript">

  var _gaq = _gaq || [];

  _gaq.push(['_setAccount', 'UA-XXX]);

  _gaq.push(['_setDomainName', 'none']);

  _gaq.push(['_setAllowLinker', true]);

  _gaq.push(['_trackPageview']);

  (function() {

    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

  })();

 

 

  try {googlePushOrder();} catch(e) {};

 

</script>

 

 

GOOGLE CONVERSION CODE – ADWORDS

<script type="text/javascript">

/* <![CDATA[ */

var google_conversion_id = XXX;

var google_conversion_language = "en";

var google_conversion_format = "3";

var google_conversion_color = "ffffff";

var google_conversion_label = "XXX";

var google_conversion_value = 0;

if ("<%=getCurrentAttribute('confirmation','subtotal')%>") {

 

  google_conversion_value = "<%=getCurrentAttribute('confirmation','subtotal')%>";

}

/* ]]> */

</script>

<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">

</script>

 

<noscript>

<div style="display:inline;">

<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/XXX/?value=1&amp;label=IO1nCIK3pwIQyuy3_wM&amp;guid=ON&amp;script=0"/>

</div>

</noscript>

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

These scripts for for the “cart” page. It is nice to track items added to cart vs. conversion. But don’t get too caught up in shopping cart abandonment rates. That’s another story entirely.

 

<!-- Google Code for Added to Cart Conversion Page -->

<script type="text/javascript">

/* <![CDATA[ */

var google_conversion_id = XXX;

var google_conversion_language = "en";

var google_conversion_format = "3";

var google_conversion_color = "ffffff";

var google_conversion_label = XXX";

var google_conversion_value = 0;

/* ]]> */

</script>

<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">

</script>

<noscript>

<div style="display:inline;">

<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1072559690/?value=0&label=_0m1CNrngwMQyuy3_wM&guid=ON&script=0"/>

</div>

</noscript>

 

 

 

 

<!-- Google Website Optimizer Tracking Script -->

<script type="text/javascript">

  var _gaq = _gaq || [];

  _gaq.push(['gwo._setAccount', 'UA-XXX']);

  _gaq.push(['gwo._trackPageview', '/XXX/goal']);

  (function() {

    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

  })();

</script>

<!-- End of Google Website Optimizer Tracking Script  -->

 

 

 

<script type="text/javascript"> if (!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};</script> <script id="mstag_tops" type="text/javascript" src="//flex.msn.com/mstag/site/315f529b-8c38-45e7-972e-e32354a4941f/mstag.js"></script> <script type="text/javascript"> mstag.loadTag("analytics", {dedup:"1",domainId:"XXX",type:"1",revenue:"",actionid:"XXX"})</script> <noscript> <iframe src="//flex.msn.com/mstag/tag/315f529b-8c38-45e7-972e-e32354a4941f/analytics.html?dedup=1&domainId=939645&type=1&revenue=&actionid=XXX" frameborder="0" scrolling="no" width="1" height="1" style="visibility:hidden;display:none"> </iframe> </noscript>

 

 

 

 

 

 


Tag(s): Online Conversion Tracking with Google, Bing/Yahoo