Suppose you intend to run a Google Optimize test on a webpage containing subfolders such as /product and /product/myproduct. In that case, you can use a regular expression rule to target the root page exclusively without affecting subfolders. By applying the .*$ regular expression, you can prevent the test from considering anything beyond the target URL /explore, as shown in the image above. This Google Optimize URL regex hack can be used for various A/B testing purposes.
Google Optimize is an excellent tool for performing A/B testing on your website. For a client, I ran a split traffic test between an existing web app and a new landing page that replicated its behavior. We used Optimize to conduct the split traffic test by splitting traffic using a URL pageload event. However, the web app had numerous features that the landing page didn't offer, such as search capabilities. When we attempted to link back to the main page, it kept pushing us back to the variant, making it impossible to use the extra functions of the web app. Therefore, users of variant B were stuck in an endless cycle of searching for more stuff but never finding it.
After extensive research, I discovered that Google Optimize supports regular expressions (regex) on URL targeting, which can be used to ignore everything beyond the landing page (in this case, /explore) to target the landing page only. By utilizing the regex, we were able to prevent the test from pushing users back to the variant and avoid the issue of limited search capabilities.
Reach out to us today. We are always working to improve our services so you can stay on top of your digital marketing goals. Simply fill out our online form to get jump-start your digital marketing today!