Example Google Analytics ga.js tracking code for Miva Merchant 5.5:
What is ga.js? Click here for details.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | <!--
Begin Google Analytics ga.js Tracking Code
This Notice MUST Stay Intact For Legal Use
Copyright Kemper Strategic E-Business (KSE)
Visit http://www.kemperstrategic.com/ for Professional Integration
-->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
<mvt:if expr="g.Screen EQ 'PROD'">
var productCode = "&mvte:product:code;";
<mvt:elseif expr="g.Screen EQ 'CTGY'">
var categoryCode = "&mvte:category:code;";
<mvt:elseif expr="g.Screen EQ 'SRCH'">
var searchQuery = "&mvte:global:Search;";
<mvt:else>
var screenCode = "&mvte:global:screen;";
</mvt:if>
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
<mvt:if expr="g.Screen EQ 'PROD'">
pageTracker._trackPageview('/product/' + productCode + '.html');
<mvt:elseif expr="g.Screen EQ 'CTGY'">
pageTracker._trackPageview('/category/' + categoryCode + '.html');
<mvt:elseif expr="g.Screen EQ 'SRCH'">
pageTracker._trackPageview('/SRCH.html?Search=' + searchQuery);
<mvt:elseif expr="(g.screen EQ 'BASK')">
pageTracker._trackPageview('BASK');
<mvt:elseif expr="(g.screen EQ 'ORDL')">
pageTracker._trackPageview('ORDL');
<mvt:elseif expr="(g.screen EQ 'OCST')">
pageTracker._trackPageview('OCST');
<mvt:elseif expr="(g.screen EQ 'OSEL')">
pageTracker._trackPageview('OSEL');
<mvt:elseif expr="(g.screen EQ 'OPAY')">
pageTracker._trackPageview('OPAY');
<mvt:elseif expr="(g.screen EQ 'SFNT')">
pageTracker._trackPageview('/');
<mvt:elseif expr="(g.screen EQ 'INVC')">
pageTracker._trackPageview('INVC');
pageTracker._addTrans(
"&mvte:order:id;",
"",
"&mvte:order:total;",
<mvt:if expr="l.settings:order:charges"><mvt:foreach iterator="charge" array="order:charges"><mvt:if expr="l.settings:charge:type EQ 'TAX'">"&mvte:charge:amount;",</mvt:if></mvt:foreach><mvt:else>"0.00",</mvt:if>
<mvt:if expr="l.settings:order:charges"><mvt:foreach iterator="charge" array="order:charges"><mvt:if expr="l.settings:charge:type EQ 'SHIPPING'">"&mvte:charge:amount;",</mvt:if></mvt:foreach><mvt:else>"0.00",</mvt:if>
"&mvte:order:ship_city;",
"&mvte:order:ship_state;",
"&mvte:order:ship_cntry;"
);
<mvt:foreach iterator="item" array="order:items">
pageTracker._addItem(
"&mvte:order:id;",
"&mvte:item:code;",
"&mvte:item:name;",
"",
"&mvte:item:price;",
"&mvte:item:quantity;"
);
<mvt:foreach iterator="option" array="item:options">
</mvt:foreach>
</mvt:foreach>
pageTracker._trackTrans();
<mvt:else>
pageTracker._trackPageview('/' + screenCode + '.html');
</mvt:if>
} catch(err) {}</script>
<!--End Google Analytics ga.js Tracking Code--> |
Google Analytics Getting Started Help Documents
For professional integration of Google Analytics for Miva Merchant 5.5, click here.
* Please note this code is provided as is, with no warranty or technical support. Use at your own risk.


g.Search is the variable, however accessibility to that variable would depend on what third party solutions you have in place.
Hi there, Dan:
I don’t suppose that you could dig back into your mental archive and tell us what the Search variable would be for Merchant 4 stores.
Would it be somthing like:
%VAR(g.search)%
Thanks in advance for any help you might be able to provide.
Ryan,
It really depends on how CSE has been implemented, ie. Search Element, iFrame or Google Hosted. If you want to contact us directly, with an example url, we can take a look and provide you with the appropriate setup method.
Thanks Dan, that makes sense.
That was a little tricky to nail down at first, uncovering that just “q” minus the quotes as the Query Parameter.
Any advice on finding and replacing the &mvte:global:Search; with the actual Site Search query?
The UTMP comes over missing that part.
Ryan,
Thanks for the question. If you’re using Google Site Search, the search specific conditional code does not need to be changed, however “q” would need to be specified as a Site Search Query Parameter within the Analytics account settings.
Dan:
If you’re using Google Site Search or CSE with the GA code wouldn’t you need to change
[code]
pageTracker._trackPageview('/SRCH.html?Search=' + searchQuery);
[/code]
to something similar to
[code]
pageTracker._trackPageview('/SRCH.html?q=' + searchQuery);
[/code]
Just to make sure that GA can track search results?
This page is a great resource by the way and has made the world a better place.