====== Using Google Analytics ====== Here are just some notes I am making as I try to work out how to use this. * [[https://analytics.google.com]] - to sign up It seems that you sign up to google analytics with your google account. Then you can add websites to be analysed. Useful website: [[https://moz.com/blog/absolute-beginners-guide-to-google-analytics]] You add analytics account - you can have more than one. Eg we have New Zealand Digital Library account. Inside your account, you can have lots of properties, which are websites. Once you set up a property for a website, you get a snippet of code which goes into the head of all the pages in that website that need tracking. The code is common to all pages apart from the ID, which is unique to a property. In the following example, I have put UA-xxx as a substitute for the tracking ID. If you are writing this into XSLT file, you need to format it like this: UA-xxx ===== Adding and using new servlet params ===== To make this work I have modified the java code to store any initParams mentioned in the servlet definition (in servlets.xml) in the config_params HashMap. This gets passed to the transformer when it does the page transformation, so all of these get passed in as parameters. You can access them by declaring at the start of web/interfaces/default/transform/gslib.xsl along with the other predefined ones. Now that this has been implemented, instead of hard coding the tracking id in the xslt file, you can specify it as an initParam to a servlet (therefore each servlet can have a different one if need be) In web/WEB-INF/servlets.xml, add an init-param like the following to the main library servlet (specifying of course, your actual google id): google_tracking_id UA-xxx-1 You will need to restart the server for this to take effect.