[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Adding analytics tracking code to EPrints



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 = ('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>
 ? </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

On 19/05/2021 12:23, Ravi M via Eprints-tech wrote:
> *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
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Faurorepo.in%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce34a0523be7f405e8a5b08d91acbe6bc%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637570285313693358%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=3o%2BBQwfA6CkIory8pmR7VFKPh7bU79B7fOCEpDNxv3s%3D&amp;reserved=0 
> <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Faurorepo.in%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce34a0523be7f405e8a5b08d91acbe6bc%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637570285313693358%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=3o%2BBQwfA6CkIory8pmR7VFKPh7bU79B7fOCEpDNxv3s%3D&amp;reserved=0>
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce34a0523be7f405e8a5b08d91acbe6bc%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637570285313693358%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=lvslL9YRKLUgCqardrH%2BZGWpU5lkKMWH3vQHZtLoHLI%3D&amp;reserved=0
> *** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce34a0523be7f405e8a5b08d91acbe6bc%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637570285313693358%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Epfas3pZGvOhd3unPV57PkrcxjM%2BzeCYV4WMuxG1peU%3D&amp;reserved=0


-- 
This email has been checked for viruses by AVG.
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.avg.com%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Ce34a0523be7f405e8a5b08d91acbe6bc%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637570285313693358%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=ou0mrx7C%2F5HrQmpJx9nzHgHv%2BDj3Be4jlYSqJA%2Fl2dQ%3D&amp;reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20210519/4880d098/attachment-0001.html