User Tools

Site Tools


en:user_advanced:google_analytics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:user_advanced:google_analytics [2018/08/06 23:15] kjdonen:user_advanced:google_analytics [2023/03/13 01:46] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +
 +
 +
 ====== Using Google Analytics ====== ====== Using Google Analytics ======
  
Line 47: Line 50:
  
 </code> </code>
 +
 +===== 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 
 +<xsl:param name="param-name"/> at the start of web/interfaces/default/transform/gslib.xsl along with the other predefined ones.
 +
 +<code>
 +  <!-- some global parameters - these are set by whoever is invoking the transformation
 +  Any servlet init parameters can be accessed by adding a param here-->
 +  <xsl:param name="interface_name"/>
 +  <xsl:param name="library_name"/>
 +  <xsl:param name="site_name"/>
 +  <xsl:param name="use_client_side_xslt"/>
 +  <xsl:param name="filepath"/>
 +  <xsl:param name="google_tracking_id"/>
 +
 +</code>
 +
 +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):
 +<code>
 + <init-param>
 +   <param-name>google_tracking_id</param-name>
 +   <param-value>UA-xxx-1</param-value>
 + </init-param>
 +
 +</code>
 +
 +You will need to restart the server for this to take effect.
en/user_advanced/google_analytics.1533597317.txt.gz · Last modified: 2018/08/06 23:15 by kjdon