Example 2: Google Tag Manager (tracking)

When you implement A/B testing (or other Smart Content) you will want to track the results.

In this example we are going to add Google Tag Manager to our website to track the A/B results of the previous example: https://support.sitemanager.io/ab-testing-cta-banner

However you can use any website tracking tool you like and implement it.

1. Add Google Tag Manager

Go to the Upgrade Center and click SEO and Analytics


Search for Google Tag Manager and add it to the project.


Don't forget to set-up your Google Analytics if you haven't already.


2. Tag Manager selector ID

Using Tag Manager, you can create triggers when for example a button is clicked. To make it simple you can add an unique ID to the button of your CTA.


Go to the code section of your CTA component and add a unique ID to the link. You can use the SiteManager ID variable [:swpageitemid:] that will be unique for every page component.


3. Tag Manager Trigger

Create a Google Tag Manager account https://tagmanager.google.com/#/home if you have not already done so.

Find more information about Google Tag Manager here:




In the example below you see we created two triggers when the A or B button is clicked


Configuration example of the trigger:



4. Tag Manager Tags (Analytics)

After we build our triggers we need to link them to our Google Analytics using Tags.


We build two tags linking the respectable triggers to our linked Google Analytics.


Example of the configuration of a tag:



5. Google Analytics

Everytime the A or B version of our CTA is clicked on the website it will be pushed automatically as an event inside Google Analytics.


In Google Analytics select Behavior > Events > Overview


In the example below you can see the B version of our CTA is outperforming the A version.


The data for knowing how many times a certain version has been shown to a visitor can be found inside the SiteManager CMS where the A/B testing rules have been set. In this example we have done this in the settings of the Home page.