Introducing Google Tag Manager for CiviCRM

We’ve partnered with Population Matters to create a Google Tag Manager extension for CiviCRM.

The issue

No doubt many organisations use Google Analytics and whilst they probably have lots of tracking in place, we established that current extensions and functionality for CiviCRM did not allow putting monetary value to conversions.

This is especially important for organisations that receive Google Ad Grants as it’s a compliance requirement for grants. In order to use Ad Grants to drive meaningful impact, accounts must have conversion tracking set up following tailored requirements intended to suit the needs of nonprofits. Examples of meaningful conversion goals include donations, purchases, ticket sales, membership registrations, email sign-ups, etc.

Our solution

We reviewed options and spoke to some organisations and found out that quite a few already had Google Tag Manager (GTM) set up which allows user to capture transactional data in a custom layer. We therefore decided to write an extension that adds these layers automatically to contribution and event thank-you pages rather than having to inject custom code in page templates.

For now we have gone with some basic data layer variables to be included (page title, total amount, currency, frequency, financial type and campaign) – all you need is install and enable the extension and add your Google Tag Manager ID in the configuration settings.

Once in place, you are able to create your relevant GTM events.

A known limitation is that the data is only sent on the initial transaction by each user. It won’t send data when repeating subscription transactions are taken automatically.

How it works

The idea is that information from CiviCRM thank you pages should be made available when a transaction has been successfully completed. The kind of date we are interested in includes:

  • Financial value
  • Currency
  • Transaction type: e.g. one-off donation, monthly recurring contribution, annual membership sign-up.

Importantly, to comply with privacy constraints, we don’t want to expose any personally identifiable information (PII) such as name, address, credit card details, etc.

This data is available to CiviCRM but is not easy to get at for use with other tools such as Google Analytics.

To make this work, the extension listens for a successful transaction within CiviCRM. When the data becomes available, it exposes this within the “success” page via the data layer.

The data can be picked up by other tools and passed on as appropriate. For example, Google Tag Manager can be configured to look out for the specific data we are exposing. This can then be passed onto Google Analytics, or any other tool that can be configured to receive data from Google Tag Manager.

Of course, as the data is exposed in a standard-format data layer variable, tools other than Google Tag Manager could also be used to listen for the data.

You can find guidance on how to set up the data layer variables, GA4 triggers and GA4 tags in the extension documentation.

A big thank you

Thank you to our client Population Matters for their support to make this extension possible and Dotwise for sharing their Google Analytics and GTM knowledge with us to ensure the data coming in can be used to establish meaningful reports.

You can find the extension in the official Extension Directory and will be available for automated distribution once it’s approved.

You can also read this blogpost on the CiviCRM blog for more details on getting started and other support you may need with Google Tag Manager for CiviCRM.