
The loss of life of Google Optimize is upon us. And wowee, aren’t you a bit bit heartbroken. Gone are the times the place you’ll have the ability to swap a button in your web site from purple to inexperienced and run a senseless A/B check. Now it’s a must to pay $60,000 yearly for that. However wait! What if I advised you you could proceed to run A/B testing FOR FREE, leveraging instruments which can be most likely already in your web site. Would you pay me $60,000? How about $2? I’ll take it…
Now don’t get me improper, you must completely put money into an A/B testing platform. They’ve a butt-ton—(can I say butt-ton?…no? Okay how about boatload)—a boatload of options that transcend what I’m about to point out you. Additionally, A/B testing on the whole ought to have a devoted course of, with a well-thought-out testing matrix, strategists, builders, designers and analysts. In the event you’re going to have all of that, you must most likely have a devoted device,proper? In the event you simply need to be a bit whimsical about it although, I’ll present you how one can do testing with out something fancy. Just a bit grease in your Google Tag Supervisor wheels and any analytics platform.
Primary Steps Beneath:
The right way to A/B Take a look at for Free with Google Tag Supervisor, and any advertising analytics device.
Let’s get began. First, this publish assumes that you’ve a fundamental understanding of Google Tag Supervisor, triggers, variables, & tags. In the event you don’t, then please go away and go to MeasureSchool’s YouTube to be taught all concerning the device. If you’re nonetheless studying then I’ll assume we’re good to go.
Create a New Cookie in GTM
First lets construct a Cookie in GTM by importing the template “Cookie Creator” from the Neighborhood Gallery. Evaluation the permissions (which permit cookies to be written when you specify them within the template) of this Tag Template and choose “Add to Workspace.”
You may as well simply construct a cookie utilizing customized HTML, however why work more durable than it’s a must to? After you have imported it into your templates and accepted permissions, you can begin constructing a number of cookies with ease.
Earlier than we begin constructing our experiment, we have to permit this cookie creator to construct the cookie we inform it to. To do that, open the Cookie Creator template and navigate to “Permissions”.
Subsequent add an allowed cookie for _gtm_exp or no matter identifier you’d wish to construct on your GTM experimentation.
Create a GTM Experiment Tag
Within the Tags tab, create a brand new tag utilizing the Cookie Creator tag template you’ve simply saved.
- Set Cookie Identify to “_gtm_exp”
- Set Cookie Worth to “abc”
- We’ll be updating this worth later to dynamically populate primarily based on random allocation. Since we will’t save the tag with a clean worth, let’s add “abc” to the cookie worth for now.
- Set Expiration Mode to “By month”
- Set Expiration by Months to “6m”
- “Even when your experiment length is shorter than 6 months, having an extended expiration date ensures that customers will proceed to see the identical experiment on return visits till this cookie is eliminated”
It’s possible you’ll need to set further cookie options- like SameSite you probably have subdomains, and so forth. -but we’re going to go away it clean for now. Be happy to make use of this FireFox page as a useful resource for all of the totally different configurations you are able to do with cookies.
It can save you the tag and not using a set off for now. We’ll come again to it!
Construct a Variable to Seize the first Get together Cookie
Let’s now go into our variables part and construct a 1st Get together Cookie to seize the brand new cookie worth that we created:
- Navigate to the Variables tab
- Click on to create a brand new Consumer-Outlined Variable
- Choose “1st Get together Cookie” because the Variable Kind
- Replace the Cookie Identify to “_gtm_exp”
- Give your variable a reputation and save
Superior. That was simple. We’ll come again to utilizing this later.
Construct a Variable to Generate a Random Quantity Between 0-99
Now, we need to create the performance to generate a quantity from 0-99. This can develop into the idea of our check performance.
- Click on to create one other Consumer-Outlined Variable
- Choose “Customized JavaScript” because the Variable Kind
- Add a operate to generate a random quantity. Right here is a few code so that you don’t have to go searching on the net for it. You’re welcome.
operate() {
var math = Math.ground(Math.random() * 100);
return math
}
- Marvel in marvel on the extremely superior, complicated little bit of JavaScript you’ve simply written
- Identify your variable “Random Quantity (0-99)”
Create a RegEx desk Variable for the Cookie
We now need to use our random quantity to set a cookie worth primarily based on whether or not a person is assigned to the management group or the check group. You might additionally create a number of variations by adjusting this logic with the quantity of numbers that characterize a model. On this model we’re in search of 0-49 & 50-99 to set totally different variations, however you possibly can simply modify to 0-33, 34-66, 67-99 for an A/B/C check (and so forth.)
- Create a brand new RegEx Desk variable
- Set the Enter Variable to the random quantity variable you’ve simply created
- Use this RegEx to focus on the split-test numbers:
- Management Group: 0 – 49
- RegEx Sample: ([0-9]|[1-4][0-9])
- Take a look at Group: 50-99
- RegEx Sample: ([5-9][0-9])
- The Output values might be primarily based on the kind of check you’re working. For this instance, we’ll be doing a easy CTA button textual content change.
Replace Cookie Tag with RegEx Desk Variable
Now that we have now our RegEx desk, we will use it to construct the performance of our break up check. We’ll be utilizing the 0-49 randomized quantity to set the management & 50-99 to set the variant.
To do that we need to return into our cookie creator tag and set the Cookie Worth to our RegEx desk.
For the set off we wish it to fireplace on all pageview occasions the place the cookie doesn’t but have a price that features our check.
Now that we have now the cookie in place, we will construct our precise check.
Create a Customized HTML Tag with Your Adjustments
Now might be essentially the most difficult half. You will must know a little bit of JavaScript however when you don’t, ChatGPT is a superb useful resource. Simply ask it that can assist you goal and alter the aspect you need to change. Sadly, GTM will not be geared up with a visible editor like Google Optimize that can assist you change. If you want you need to use a chrome extension corresponding to “visual css editor” which has plenty of the identical performance as a CRO visible editor and even helps you export code. Total, you’ll most likely hit a snag sooner or later and want some assist from both AI or a JavaScript developer. Regardless, I used ChatGPT for this alteration and if it’s ok for me, it’s ok for you!
For this instance, we’ll be updating the textual content of the hero tagline through the use of a Customized HTML tag.
Step 1: Create a brand new Customized HTML tag. This can comprise any mandatory scripts to change web site content material on your Take a look at Group.
Step 2: Within the HTML part, add your script. This instance might be utilizing the script beneath to replace the textual content of the hero tagline:
<script>
var tagline = doc.querySelector('.hero-tagline');
if (tagline) {
tagline.innerHTML = 'Construct Sustainable Development <i class="far fa-arrow-right" aria-hidden="true"></i>';
}
</script>
3. Give your new tag a reputation. On this case, we’ll identify it “Replace Hero CTA for Take a look at Group”
Now that we have now our code, let’s set off it on 50% of the site visitors.
Set off Your Take a look at on the Variation Set off.
Now that the cookie is positioned, we simply must search for the worth we wish the check to set off on and add our set off situation to our Customized HTML tag.
You’ll doubtless need to check at this level. Testing is fairly easy. Simply go to your preview mode, and open the web page you need to check on. You’ll get your randomly generated worth and it’ll set a cookie because it’s your first time there. You may then navigate to the Chrome debugger and edit the cookie worth between your management and variant by discovering the cookie worth in Functions and in search of our _gtm_exp cookie.
Nice, now that we have now the check setup portion carried out, let’s get that child into our analytics system.
Construct Out the Analytics Portion
This subsequent half could be utilized to ANY analytics device. I might be focusing this weblog on GA4 and Microsoft Readability however the identical course of could be utilized to Piwik Professional & HotJar, Matomo & ContentSquare. No matter you need. We’re going to use it to each a advertising analytics device and a heatmap software program only for enjoyable however it may be used with only one device if that’s your desire.
Add to your Analytics Tag
First, similar to with CRO instruments, we’d like to verify our cookies load earlier than info will get despatched to our analytics instruments. So in case you are firing your advertising analytics device on Pageview as properly, we’re going to want so as to add an analytics occasion that fires when the cookie is ready.
Let’s create the occasion. This occasion fires the precise occasion but in addition units the cta_button_audience to the management or the variant in our GA4 and ties it to the person. This would be the foundation of our viewers parameters.

Now let’s make it a cleanup tag for our cookie placement.
Superior. One last item. We additionally need to add to our predominant configuration tag. This ensures that as folks come again to the web site and the variant is there, it additionally communicates the worth to the user-level customized dimension. It ought to stay with that person however it is a secondary degree of safety from GA clear cache and so forth. It turns into a bit safer than simply counting on the occasion itself because the occasion solely fires the preliminary time that the person will get bucketed. The cookie will stay as a price so long as it’s saved within the individual’s browser. After the preliminary placement, the cookie needs to be there on web page load so you’ll be able to seize it together with your predominant configuration on pageview.

Observe: You may as well simply transfer GA4 config to Dom Prepared as an alternative of doing the above (with the identical configuration tag adjustments) however some individuals are violently towards altering the place GA hundreds, in order that’s why we did the above strategy.
One other Observe: you’ll be able to really set the variable to an occasion degree parameter as an alternative of a user-based one since we might be constructing it as an viewers who noticed the actual occasion anyway, however I feel Consumer Properties are a bit cleaner. If you’re working low on Consumer-level customized dimensions, occasion customized dimensions are fantastic.
Construct Your Conversions
If you have already got a conversion that you just need to use with this setup you’ll be able to skip this part. In any other case, if you wish to arrange a secondary conversion or you haven’t any conversion you’ll be able to observe together with the beneath to arrange one.
Often, our predominant conversion could be a kind submit or buy, however we’re going to use cta clicks for this instance.
Go into preview & debug mode and carry out the motion that you just need to observe.
Be sure you have any related built-in variables (click on id, click on class) and triggers (all parts/hyperlink clinks) enabled in your GTM.
Navigate to the clicking motion that you just did and discover the related variable that you just need to observe.
Construct your set off and occasion/conversion.

Nice! We’ve simply arrange the motion we need to use in GA4 as considered one of our conversions. The great factor about constructing an viewers or section with our variations is that you need to use these together with different conversions or occasions which can be already in place (thanks pages, and so forth.)
Set Up the Conversion in Your Advertising Analytics Instrument
In GA4, there are a number of steps we have to take to get this to work. First, we have to arrange our conversions. Some could already be arrange, however the one we simply constructed above we have to set as a conversion. You may both watch for the occasion to point out up in GA4 after which examine the little blue toggle subsequent to the occasion, or we will navigate to conversions and enter the identify of the occasion manually. Let’s do this one.
Set Up Your Customized Dimension in your Advertising Analytics Instrument
Now that we have now our conversion, let’s navigate to customized dimensions. Let’s create each a Consumer primarily based customized dimension for our cta_button_audience which is dealing with our cookie worth.
Observe: In the event you don’t have click_text arrange as a price in GA4 already, you’ll need to do this now for the cta_button_click occasion that we constructed. Each customized dimension must be outlined in GA4 for the info to point out up within the interface.
Lastly, Let’s Construct our Audiences!
You’ll need a distinctive viewers per variant (together with management).
You’ll need to verify that the quantity of customers in each the variant and the management are comparatively equal. This might be an extra-level of consolation that our triggers and tags are working.
Now all we have now to do is do an viewers comparability with our conversions and we’re swimming in A/B check sauce.
You may construct an viewers report by making a customized report within the library and utilizing the viewers as a dimension.
Alternatively, you possibly can use our user-level customized dimension
I discover it’s a bit cleaner to make use of an viewers as a result of you’ll be able to archive audiences when you find yourself carried out with the check and you may select to make use of the gtm_exp cookie to construct different exams sooner or later and audiences assist present a basic cleanliness across the reporting.
To run statistical significance monitoring you need to use any A/B check calculator however my most popular is CXL’s AB Test Calculator. Simply dump your information in and it’ll calculate the raise for you!
Nice job! You made it and may cease right here. Or we will convey each variations into Microsoft Readability. You need to proceed??? I APPLAUD your tenacity.
Combine with Heatmap
For this a part of the lesson, we are going to assume you’ve got Microsoft Readability up and working. I like Microsoft Readability quite a bit. It’s free and has a TON of options which can be actually precious. For this explicit job, we’re going to be utilizing the customized tag filter characteristic.
Navigate again into Google Tag Supervisor and discover the Microsoft Readability group template by Luratic. If in case you have Microsoft Readability hard-coded, I recommend you migrate it to the template as a way to use their built-in customized tag characteristic, which we’ll be using for this experiment. You may as well do that with code as an alternative of the template in case you are a masochist.
Add in a key: cta_button_audience with the worth of our GTM_Exp. Now you’ll have the ability to filter all pages by your cookie variation!
You may go one step additional by additionally constructing customized occasions on your CTA clicks & conversions, which can make discovering particular recordings a lot simpler.
Now we have now our new Customized Tags. Navigate again to Microsoft Readability and discover the customized filters.
Now we will filter by each our key motion that we need to see and likewise the totally different variations. This offers us final readability (pun supposed) into how the totally different pages are performing with our variations! Give it a number of days and also you’ll get your adjustments in two totally different heatmaps!


BONUS: when you combine GA4 with Microsoft Readability you may as well pull in your GA4 segments (audiences), making this a breeze to investigate! I nonetheless like having the filters however it may assist streamline the method.
PHEW! We’ve Reached the Finish
You probably did it! You made it! You created a totally functioning A/B check machine in GTM with FREEEEE instruments. However yeah that was plenty of work. It’s possible you’ll need to pay for one thing to keep away from the lengthy and drawn out (however cool) course of above. However when you don’t and you find yourself utilizing this resolution…perhaps you’ll be able to pay me as an alternative 🙂
#Take a look at #Free #Google #Tag #Supervisor #Advertising #Analytics #Instrument