Installing and using Google Tag Manager

Difficulty: Advanced | Updated: February 27, 2023
The instructions on this page are for AdRotate Pro 5.12.1 and newer.

In AdRotate Pro you can track Impressions and Clicks using Google Analytics 4 Custom Events.
You can use Google Tag Manager available in your Google account. If you prefer to use the Global Tag, go there instead. Both do the same thing but the Global Tag is much easier to set up.

Using the Google option all statistics are tracked externally, using onload and onClick attributes, AdRotate adds those to your adverts where required and compatible.

For simple banner images, both clicks and impressions can be tracked. Most HTML5/iFrame adverts work for Impressions only. AdRotate Pro can detect the format and add the tracking code by itself in most adverts.

Installing Google Tag Manager

To use Google Tag Manager you need an account with that, but also a Google Analytics account. If you are using Google Tag Manager already you should already have the Google Tag Manager tracker installed on your website and you can skip this section. AdRotate uses this code to push its Custom Events to Google Analytics via the dataLayer function. Make sure it’s set up correctly or add it if you haven’t already check the Google instructions in your Tag Manager account to add the code.

Also make sure Tag Manager is set up to forward data to Google Analytics 4 using a Google Analytics: GA4 Configuration tag.
Read more about that here: Configure Google Analytics 4 tags in Google Tag Manager

Setting up a tag for AdRotate Pro in Google Tag Manager

If you’re already familiar with Google Tag Manager this should be fairly straightforward. We’re going to set up a Tag with a Trigger and the trigger uses a couple of custom variables. Nothing crazy, but it takes a little doing to set up.

Creating Variables

For the Event to work we need 2 variables. This tells Google Analytics which advert the event is about and what interaction to record.

In your Google Tag Manager dashboard navigate to the website or account you want to add the custom Tag and in there navigate to Variables, which should be visible on the left hand side.

In the Variables dashboard click on New.

In the form that appears select Data Layer Variable and below it enter advert_interaction as the name and choose Version 2 as the Data Layer version. Click Save and create the 2nd variable the same way but with the name advert_name.

Creating Triggers

Next, in the left hand menu navigate to Triggers and click New.

Select Custom Event and in the form that appears enter the Event name as AdRotatePro.
Below it select to trigger the event on Some Custom Events and select the variable Events, select equals and enter AdRotatePro .

Creating the Tag

And finally, we’ll create the Tag and link it to Google Analytics 4.
In the left hand menu click the Tags menu and click New.

In the submenu select Google Analytics: GA4 Event and for the Configuration Tag you can select your Google Analytics 4 ID if you have it set up. Or you can select None – Manually set ID and enter it in the field that appears below it.

For the Event Name select the {{advert_interaction}} value and in the Event Parameters section add the advert_name parameter with the corresponding advert_name value.

And lastly, in the block below it, select the AdRotatePro trigger you created earlier.
Done – Events sent from AdRotate Pro should now appear in your Google Analytics 4 dashboard.

Back to AdRotate Manuals

You may be interested in