EPrints Technical Mailing List Archive
Message: #08619
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Adding analytics tracking code to EPrints
- To: <eprints-tech@ecs.soton.ac.uk>, Ravi M <rm@auroville.org.in>
- Subject: Re: [EP-tech] Adding analytics tracking code to EPrints
- From: David R Newman <drn@ecs.soton.ac.uk>
- Date: Wed, 19 May 2021 14:42:06 +0100
Hi Ravi,
This should be farily straightforward. Edit you archive's lang/en/templates/default.xml and lang/en/templates/default_internal.xml and add the following markup in the <head> section of the template, (updating to include your UA number):
<script type="text/_javascript_">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type =
'text/_javascript_'; ga.async = true;
ga.src = "" == document.location.protocol ?
'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
Once you have done this you will need to run generate_static as you mentioned. Non-static pages should automatically update and browse views either will be updated next time generate_views runs or their cache expires. You may want to click on the Regenerate Views and Regenerate Abstracts buttons on the Admin Page -> System Tools menu to make 100% certain all pages are updated to include Google Analytics but I don't think this is technically necessary.
Regards
David Newman
CAUTION: This e-mail originated outside the University of Southampton.Hello,
I'd like to add an analytics tracking code on my EPrints site. The code is supposed to be added to the <head> section of HTML files, but the static pages in EPrints are generated via bin/generate_static. I'm not sure how to proceed, and I couldn't find anything about this in the documentation. Would anyone be able to help?
Best wishes,Ravi
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech *** Archive: http://www.eprints.org/tech.php/ *** EPrints community wiki: http://wiki.eprints.org/
- References:
- [EP-tech] Adding analytics tracking code to EPrints
- From: Ravi M <rm@auroville.org.in>
- [EP-tech] Adding analytics tracking code to EPrints
- Prev by Date: [EP-tech] eprints 3.4 Add a new field to the eprint Abstract page
- Next by Date: Re: [EP-tech] eprints 3.4 Add a new field to the eprint Abstract page
- Previous by thread: [EP-tech] Sort view with creators_name and corp_creators
- Index(es):