Hi Everyone,


Firstly, many thanks to everyone who replied to my query both on the list and directly to me.


I thought I’d let you know how I got Google Analytics working with Vufind.


As suggested, the file to be edited is layout.tpl under the theme you are using.


I added the following <script/> tag to the end of the <script/> tags in the </head>


<script type="text/javascript">{literal}var _gaq = _gaq || [];_gaq.push(['_setAccount', 'xx-xxxxxxxx-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);})();{/literal}</script>


Obviously you would need to use your own account id for Google.


The trouble I encountered with the default javascript that Google provide, is that the Smarty Templates were trying to parse it, and throwing an error. So I surrounded the Java Script with the {literal}{/literal} tags you can see above and this did the trick and it works perfectly well.


Once again, many thanks to those of you who took the trouble to reply.


Best wishes,




From: Eoghan Ó Carragáin [mailto:eoghan.ocarragain@gmail.com]
Sent: 29 November 2010 20:02
To: Andy Latham
Cc: vufind-general@lists.sourceforge.net
Subject: Re: [VuFind-General] Google Analytics in Vufind


I'm not sure what Google currently recommend regarding where to place the snippet - it used to be before the closing </body> tag but the last time I set up an analytics profile, the recommendation was to place it before the closing </head> tag. I think there are more sophistocated setups which split the snippet too.

In any case, as regards vufind files, you'll probably only need to edit /web/interface/themes/[theme-name]/layout.tpl (where [theme-name] = classic, defaual, etc). All other templates use this file as a base & it contains the <html />, <head /> and <body /> elements. If you're enabling the mobile theme, you should add the snippet to its layout.tpl too (ie. /web/interface/themes/mobile/layout.tpl).

Hope this helps,

On 29 November 2010 12:19, Andy Latham <andy.latham@gmail.com> wrote:

Hi everyone,


I'm new to Vufind, so apologies for the "new boy" question :)


I've just got Vufind up and running with our (small) library catalogue and would like to integrate Google Analytics.


I was wondering if anyone could recommend a good place to insert the Google Analytics JavaScript snippet in the Vufind code and/or templates?


Many thanks in advance for any help you might be able to provide.


Best wishes



Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
VuFind-General mailing list


Please consider the environment before printing this email.

Find out more about Talis at http://www.talis.com/
shared innovation™

Any views or personal opinions expressed within this email may not be those of Talis Information Ltd or its employees. The content of this email message and any files that may be attached are confidential, and for the usage of the intended recipient only. If you are not the intended recipient, then please return this message to the sender and delete it. Any use of this e-mail by an unauthorised recipient is prohibited.

Talis Information Ltd is a member of the Talis Group of companies and is registered in England No 3638278 with its registered office at Knights Court, Solihull Parkway, Birmingham Business Park, B37 7YB.

Talis North America is Talis Inc., 11400 Branch Ct., Fredericksburg, VA 22408, United States of America.