Why Google Tag Manager with Jive?

You can update the tracked objects or metrics without having to edit your Jive instance configuration each time. That is especially useful for people on Cloud instances who cannot edit the script call themselves.

The value for Hosted customers is that you have less risks of hanging the system as you don’t fiddle with it!

Google Tag Manager also allows you to have multiple access and version control: you don’t need to give full system administrator access to your community to people only maintaining the metrics…

The detailed principle is not only usable on Jive communities as it is generic. I have transposed my “legacy” Tags/Rules/Macros to the new beta Tags/Triggers/Variables. If you encounter issues using my description, please let me know so I can correct/ improve it.

Requirements to Install Google Tag Manager (GTM) on Your Jive community

You will need to have access to the theme and add a Javascript code in it. If you wish to use Jive variables in your GTM tracking, you need to execute your script after they are declared. Therefore, adding the code in the <head> or at the start of the <body>, as advised by Google, may not be possible for you.

1. Create Your Tracker

After having created an account, you will create your container. If you have a test instance, I would strongly recommend you do a separate container for it, so you can test freely without impacting production.

You will get the code to install in the following format:

<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
<!-- End Google Tag Manager -->

NOTE: don’t copy the code above, but take the personalised one by clicking on the GTM-XXXXX link in the top left.

2. Add The Container Code to Your Theme

I personally added it at the bottom of the /template/decorator/default/header-meta.ftl. However, I will move it down the page in /template/decorator/default/footer-javascript.ftl once I use GTM with some Jive variables. Of course, this will impact the captured time spent on page as it will start to count later.

3. Configure Your GTM Container

As opposed to the standard Google Analytics, the Google Tag Manager does NOTHING out-of-the box!

There are three parts to GTM:

  1. Tags: triggers, events, views…
  2. Triggers: when you want to run tags, capture events, views…
  3. Variables: genericize values (constant), functions…

3.1. Google Tag Manager User-Defined Variables

User-Defined Variable Constant

User-Defined Variable Constant

We start from the end (if we look at the user interface) because we need to declare the variable/ constant before we can use it.

To track outbound links, I only have one User-Defined Variables: UA_PROD_ID which is constant set to my Google Universal Analytics ID, in the format UA-XXXXXX-XX.

You also need to tick the box for “Click URL” in the “Enabled Built-In Variables”.


3.2. Google Tag Manager Trigger

GTM Outbound Click Trigger

GTM Outbound Click Trigger

Create a new trigger called “Outbound Click Trigger”. The event is “Click”. The trigger type is Link Click, with a maximum of 2000ms wait.

Enables when Page URL matches RegEx .*

Conditions are:

  • {{Click URL}} does not contain yourdomain.com
  • {{Click URL}} does not contain javascript:
  • {{Click URL}} does not contain data:

3.3. Google Tag Manager Tag

GTM Outbound Links Click Tag

GTM Outbound Links Click Tag

You create a tag called “UA Event on Outbound Link Click” of the type “Google Analytics”.

In Tracking ID, you can use the variable we created: {{UA_PROD_ID}}. It may not sound useful to have created a macro at this stage, but, as you add new tags, it will make sense.

  • Track Type = Event
  • Category = Outbound Links
  • Action = Click
  • Label = {{Click URL}}
  • Value can be set if you use goals in Google Analytics.

4. Test Your Google Tag Manager Container

Go back to the container overview, then click on Preview on the top right in the Publish menu. You can now open your community and check. I advise you use the Real-Time > Events screen in Google Analytics to checks your clicks on outbound links do create events in the timeline.

If you cannot make it work, let me know and I can have a look.

5. Publish Your Google Tag Manager Container

Satisfied with your testing? Now you need to publish your container before it can be used.

In the future, remember that any change only becomes effective once the new container has been published. Publication is done from Google Tag Manager interface. You do not need to edit your community.