The Open Journal Systems (OJS) https://openjournalsystems.com/ is constructed with Smarty Templates https://www.smarty.net/.
Google Analytics instructs you to paste the tracking script directly before the </head> tag. The </head> tag for ALL OJS pages is located in the ojs/lib/pkp/templates/common/header.tpl page.
So I tried this and it didn't work. This is because the Smarty tempalte engine attempts to translate and interpret some keywords in Google Analytics script that conflicts with the Smarty template delimiter syntax.
The fix is to put {literal} and {/literal} tags around your block of code, which allows it to be taken literally.
So, this is what it looks like:
{literal}
<script>
(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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'XXXXXXX', 'auto');
ga('send', 'pageview');
</script>
{/literal}
Obviously you would want to replace the XXXXXXX with your actual google analytics tracking code. 😁
Showing posts with label Smarty template engine. Show all posts
Showing posts with label Smarty template engine. Show all posts
Subscribe to:
Posts (Atom)
Get the OpenURL of an Item in Primo New UI
I needed to view the OpenURL of an item in Primo New UI so that I could troubleshoot why one of our Alma General Electronic Services (ILLiad...

-
Primo Central Indexing Collection Lists https://knowledge.exlibrisgroup.com/Primo_Central/Product_Documentation/Primo_Central_Indexing ...
-
When writing C++ programs, you often want to set up your command prompt for building by setting the path and drive letter of your project. ...
-
Note: TTU calls Primo "EagleSearch" and so you will see me use the terms interchangably. TTU's History with Get It Now In ...