Skip to content

Instantly share code, notes, and snippets.

@hito-asa
Created April 18, 2013 08:56
Show Gist options
  • Save hito-asa/5411285 to your computer and use it in GitHub Desktop.
Save hito-asa/5411285 to your computer and use it in GitHub Desktop.
var _gaq = _gaq || [];
var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js';
_gaq.push(['_require', 'inpage_linkid', pluginUrl]);
<c:if test="${!gaq.suppressLogging}">
_gaq.push(['_setAccount', '<%= GA_PROPERTY_ID %>']);
_gaq.push(['_setSiteSpeedSampleRate', 30]);
<c:forEach var="v" items="${gaq.customVars}" varStatus="status">_gaq.push(['_setCustomVar', ${f:h(v.index)}, '${f:h(v.name)}', '${f:h(v.value)}', ${f:h(v.scope.value)}]);</c:forEach>
<c:choose>
<c:when test="${gaq.customUrl != null}">_gaq.push(['_trackPageview', '<c:out value="${gaq.customUrl}" />']);</c:when>
<c:otherwise>_gaq.push(['_trackPageview']);</c:otherwise>
</c:choose>
<c:forEach var="e" items="${gaq.events}" varStatus="status">_gaq.push(['_trackEvent', '${f:h(e.category)}', '${f:h(e.action)}', '${f:h(e.label)}', ${f:h(e.value)}, true]);</c:forEach>
</c:if>
(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);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment