Commit fd0e54a1 authored by Matija Obreza's avatar Matija Obreza

GA ga.js to analytics.js

parent dcca4ccc
<%@include file="/WEB-INF/jsp/init.jsp"%>
<c:if test="${googleAnalyticsAccount ne null}">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push([ '_setAccount', '${googleAnalyticsAccount}' ]);
try {
_gaq = _gaq.concat(_pageGaq);
} catch (e) {
}
_gaq.push([ '_trackPageview' ]);
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '${googleAnalyticsAccount}', 'auto');
var p={};
try {
if (_pageDim.institute != null) {
p.dimension1=_pageDim.institute;
}
if (_pageDim.genus != null) {
p.dimension2=_pageDim.genus;
}
console.log(p);
ga('send', 'pageview', p);
} catch (e) {
console.log(e);
ga('send', 'pageview');
}
(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>
// Other trackers?
try {
if (_pageTrackers.length > 0) {
for (var i=_pageTrackers.length-1; i>=0; i--) {
var trackerName='gat'+i;
ga('create', _pageTrackers[i], 'auto', {'name': trackerName});
ga(trackerName+'.send', 'pageview');
}
}
} catch (e) {
console.log(e);
}
</script>
</c:if>
\ No newline at end of file
......@@ -249,11 +249,7 @@
});
</c:if>
_pageGaq = [];
_pageGaq.push(['_setCustomVar', 1, 'Institute', '${accession.instituteCode}']);
_pageGaq.push(['_setCustomVar', 2, 'Genus', '${accession.genus}']);
<c:forEach items="${crops}" var="crop">_pageGaq.push(['_setCustomVar', 3, 'Crop', '${crop.shortName}']);
</c:forEach>
_pageDim = { institute: '${accession.instituteCode}', genus: '${accession.taxonomy.genus}' };
</script>
</body>
</html>
\ No newline at end of file
......@@ -135,8 +135,7 @@
});
});
_pageGaq = [];
_pageGaq.push(['_setCustomVar', 1, 'Institute', '${faoInstitute.code}']);
_pageDim = { institute: '${faoInstitute.code}' };
</script>
</c:if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment