Example 2: Google Tag Manager (tracking)

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

Our Smart Content module has recently been renamed to Logic. All documentation will be updated with the new name in the future.


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

If you haven't already added Google Tag Manager to your SiteManager project, you can check out our article on How to add Google Tag Manager.

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 a 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

Every time 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 Behaviour > 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.