Add Google Analytics or other custom analytics code to LibGuides

The Custom Analytics settings allow you to embed JavaScript-based tracking code (from Google Analytics, for example) in all of your public LibGuides pages.

  1. Go to Admin > System Settings.
  2. Click on the Custom Analytics tab.
  3. In the Custom Analytics Code panel, enter the embed code provided by your analytics service in the Custom Analytics / Tracking Code text box.
  4. Click the Save button.
  5. Use the Code Location option to choose where the code should be inserted on each page. This can vary by service, so please consult their documentation for specifics.
    • Within <HEAD> Tag: select this option to insert the code at the top of each page within the <head></head> tags.
    • Before closing </BODY> Tag: select this option to insert the code at the end of the <body></body> tags.

Using Google Tag Manager?

Google Tag Manager has two bits of code to embed:

  • A <script> element that needs to go in the <head> section of each page. We recommend putting this portion in your Custom Analytics Code in LibGuides, selecting the Within <head> tag option as the Code Location.
  • A <noscript> snippet that needs to go immediately after the <body> tag on each page. The best way to do this would be inserting the code into each of your page layout templates (under Admin > Look & Feel > Page Layout). This will give you the most control over the placement of that code, though you would need to make sure that all guides are using your customized templates. For more info on customizing guide templates, see the Links & Files section below.

For more information about setting up Google Tag Manager in a website, please see the Google Tag Manager documentation.

Custom Analytics options

Related Articles