Insert the code given by Google Analytics into the correct place of your template

Checking your HTML template for pre-existing Google Analytics code

The first thing is to check whether your HTML templates already contain GA code. Having two GA codes will mean either statistics being doubled or not captured correctly. See the 'related content' on the right for more information on templates.

Once you have opened up a template, the following snippet would *generally* appear at the top of your page before the closing </head> tag. It is recommended though to check both the header and footer container areas.

Adding the code into your template

If you want to add the Google Analytics code into your template, then follow the instructions in your Google Analytics account. Usually you go to Admin then under the property column is an item called Tracking info and then Tracking code. You will be asked to copy and paste the code into the <head> area of your template. Do not place it after the <body> tag. Place it somewhere between <head> and </head>.

Checking that it is working

The easiest way to check this is by using GA's 'real time' view. GA can take a while to render the fully aggregated report in the account. You can however, see what pages or events are being triggered in real time.

In your GA dashboard, head to Real-Time and click on the Overview navigation item and on another tab, visit a page that has GA enabled.

If it works you should see an active user on your site, with the URL of the page shown. For more information on GA's real time view, see Google's help documentation here.

If it is working, then any pages with the template containing the GA code should start being logged and reported on.

Google Tag Manager

Google Tag Manager (GTM) is a product that allows you to insert multiple tracking "tags" via a single piece of code on your template. For example you may have Facebook Pixel code as well as Google Analytics. By using Tag Manager you can add them both in one piece of code in your template, which then calls up code stored in GTM.

The more powerful part is that you can link these, and other pieces of bespoke code, to "triggers", which only fire in certain circumstances. For example, for donation pages you could create Google Analytics eCommerce transactions containing the amount the supporter donated, thereby including this in your GA reports. If you want to be able to fetch the donation amount, and other variables, from the Engaging Networks page, then read "Exposing transaction details" below.

Just like adding GA code, you can add GTM code instead to your template. The code will be given by your GTM product.

Exposing transaction details

In page-builder, it is possible to have the system add a JavaScript object to your page that contains various properties of the page, such as donation amount. This can be used in Google Analytics or Tag Manager to create eCommerce transactions.

To enable this, go to where it says Hello YOURNAME in the top navigation, and then Account settings > Account Preferences and, near the bottom of the page, tick the box to "Expose transaction details". Your page-builder pages will now contain a "pageJson" object that consists of various key value pairs. Click here for more information on what the variables mean.

Example of using GTM with GA eCommerce

Once you expose transactions, you can use GTM to make eCommerce transactions. The example below adds a transaction and item, and then sends it to GA. The code is stored within GTM which fires when it encounters a URL that is a donation thank you page.

Using GA in the legacy tools

For the legacy pages, we recommend you replace your existing GA code snippit.

If your HTML Template does not contain any GA code, then all you need to do is place it between the <head></head> tags in the template. Make sure you make a backup of your template code though, in case you need to revert it.

BEFORE YOU COPY AND PASTE : You need to replace UA-********-1 with your own GA account id.

By leveraging a page insert tag called ||PAGE_TITLE||, this enables a variable to be set that the html template will render. This is found on the Admin Settings and is actually the 'Description' input box.

Friendly URL Format

The friendly URL can follow any format, so long as no spaces are used and that it begins with a forward slash. It is recommend to also not use any other punctuations other than a _ (underscore) and - (dash).

Note that in GA, the page number will automatically be added and can be used for tracking conversions. For example: the friendly URL "/engaging/target/InsideEmailcontact", set in Engaging Networks, will come through as /engaging/target/InsideEmailcontact_-_1 and /engaging/target/InsideEmailcontact_-_2 on a two page action.