- Help Center
- Configuration
-
Getting Started
-
Configuration
- Targeting
- Split URL
- Product Testing
- Full Stack
- Experiment Management
- CSP Configuration
- Experiment Execution
- Reports
- Exit Popups
- GTM Integration
- Troubleshooting
- Performance Optimization
- Event-Triggered Changes
- Holdout Groups
- Split URL Pages
- URL Parameters
- DataLayer
- Menu Configurations
- Traffic Exclusion
- Experiment Scheduling
- Dynamic Element Changes
- Price Targeting
- Experience Scheduling
- Privacy
- Hash Changes
- Async Tracking
- Selective Installation
- CSS Selectors
- Vue.js Integration
- Page Content
- Multipage Split URL
- Organic Traffic
- Visual Editor
- Server-Side Testing
- Traffic Bucketing
- GDPR Warnings
- Statistical Confidence
- Browser Privacy
- Query Parameters
- Embedded Videos
- Tracking Code Execution
- Simultaneous Experiments
- Tags
- Deployments
- Disable Testing
- Locations
- Programmatic Bucketting
- Query Parameter Handling
- Convert Library
- Variation Previews
- Experiment Editing
- Opt-Out Script
- Data Reset
- Body Hiding
- Visit-Specific Variations
- Variation Styling
- Preview Issues
- Variation Editing
- Full-Site Testing
- Blinking Variations
- Cross-Domain Cookies
- Regex Support
- Conversion Tracking
- SPA Testing
- Project Setup
- Cross-Domain Tracking
- Geo-Targeting
- Analytics Tools
- Campaign Tags
- Previewing
- IDs
- Query String Targeting
- Bounce Rate Goals
- Bot Filtering
- Query String Variables
- Custom Audiences
- Redirects
- Baseline
- Tracking Code Location
- Secure Cookies
- AngularJS
- Cloudflare
- Code Installation
-
Track Goals
- Form Tracking
- Cookie Management
- iFrame Click Tracking
- Performance Optimization
- Revenue Tracking
- Interaction Goals
- Form Submissions
- Advanced Goals
- Lazy Loading
- Multi-Conversions
- URL Parameters
- Bounce Rate Goals
- DataLayer Integration
- Scroll Depth
- Social Interactions
- Page Views
- Marketo Forms
- Feature Analysis
- AJAX Forms
- Revenue Tracking via GTM
- Order Outliers
- Cumulative Revenue
- Goal Templates
- Adding Revenue Goals
- JS-Based Goals
- Goal Basics
- Google Analytics Goals
- Social Sharing
- Dynamic Goals
- Typeform Integration
-
Target Visitors
- Geolocation
- Interaction Goals
- Goal-Based Targeting
- Weather Targeting
- Cookie-Based Targeting
- Page Visits
- Audience Management
- Audience Segmentation
- Experiment Targeting
- Advanced Audience Creation
- Audience Templates
- Audience Creation
- Data Layer Integration
- Manual Activation
- JavaScript Conditions
- Device Targeting
- Language Targeting
- IP-Based Exclusion
- Visitor Management
- Page Tagging
- Cookies
-
Troubleshooting
- Google Warnings
- Visual Editor
- HTTPS Content
- Logs
- Support Options
- Bootstrap
- Cookie Blocking
- Change History
- Mobile Debugging
- AdWords
- Bot Exclusion
- Domain Issues
- Cloudflare Issues
- Monitoring
- Cloaking Penalties
- Goal Editor Issues
- Variations
- Snippet Performance
- Changes Not Saved
- Blocked Visual Editor
- Goal Testing
- Visual Editor Browsing
- Experiment Issues
- Installation Verification
- Data Leak Prevention
- Usage Limits
- Experiment Previews
- GA4 Revenue
- Chrome Debugger Logs
- SPA Errors
- Checkout JSON Error
-
Analyze Results
-
Integrations
- Google Analytics
- Cookie Consent Platforms
- Microsoft Clarity
- Plausible
- Marketo
- HubSpot
- Tealium
- Smartlook
- Klaviyo
- Salesforce CRM
- FullStory
- Snowplow Analytics
- Webflow
- GA4 Roles
- Amplitude
- Segment
- React
- BigCommerce
- WooCommerce
- Active Campaign
- Google Tag Manager
- Mixpanel
- Zapier
- Inspectlet
- Crazy Egg
- LanderApp
- Unbounce
- Instapage
- Drupal
- PrestaShop
- Magento
- Roistat
- Piano Analytics
- Heap Analytics
- Kissmetrics
- Mouseflow
- Adobe Analytics
- Clicky
-
Account Management
-
Developers
-
What's New
-
Common Questions
-
Shopify
How to Create a Split URL Experiment That Adds a URL Query Parameter to the Variation?
This guide explains how to set up a Split URL experiment using regular expressions to effectively manage and direct web traffic by adding specific query parameters to URL variations.
Introduction
Split URL testing is an essential tool for website optimization, allowing you to compare different versions of a webpage by directing traffic to variant URLs. This guide will focus on using regular expressions (regex) to manage and direct URLs effectively in a Split URL experiment, specifically adding a query parameter to each variation.
Creating a New Split URL Experiment
-
Create a New Experience
- Go to your Experiment Dashboard and locate the "New Experience" button, typically in the top right corner. Click this to start the process of setting up a new experiment.
-
Select Split URL Experiment
- Choose the Split URL experiment type from the list of available options. Fill in the experience name and the URL of the Original site in the Visual Editor URL field.
-
Configure Original and Variation URLs Using Regex and Add Variations
-
Original URL Pattern:
- Use the following regex for the Original URL to capture the entire URL structure:
rubyCopy code^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$
This pattern decomposes the URL into components such as protocol, host, path, query string, and fragment, serving as the base for variations.
-
Variation URL Pattern:
- Modify the captured groups from the Original URL regex to include a new query parameter, ensuring systematic addition without affecting other URL components:
javascriptCopy code$1$3$5?new_param=value&$7
This adjustment appends a new query parameter (
new_param=value
), while retaining any existing query parameters. -
Adding Variations:
- Apply the defined regex pattern to set up the initial variation and add additional variations with a similar pattern to ensure consistency across tests. Name each variation clearly and add more variations if necessary using the plus icon. Traffic will be evenly distributed unless specified otherwise.
-
Example Scenarios:
- Original URL without Existing Parameters:
- Original:
https://example.com/products
- Variation:
https://example.com/products?new_param=value
- Original:
- Original URL with Existing Parameters:
- Original:
https://example.com/products?category=books
- Variation:
https://example.com/products?category=books&new_param=value
- Original:
- Original URL without Existing Parameters:
-
-
Configure the Experiment Location
- Location Setup:
- Define all potential Original URLs that will be part of the test. This includes specifying URL patterns or specific URLs where the experiment will run.
- Ensure that the Experiment Location settings encompass all URLs that might receive traffic under the conditions of the test but exclude the Variation URLs. This is crucial to prevent the experiment from looping or affecting user experience by repeatedly redirecting to the variation.
- Exclusion Note:
- It is important to specifically exclude the Variation URL from the locations where the experiment is active. This prevents the added query parameters in the Variation URL from inadvertently triggering the experiment again, which could cause looping issues.
- Location Setup:
-
Prevent Redirection Loops
- To prevent redirection loops, ensure that your experiment’s location settings exclude URLs containing the new query parameter (
new_param=value
). This is crucial to avoid creating conditions that cause users to be redirected back and forth between variations, which can corrupt data and user experience.
- To prevent redirection loops, ensure that your experiment’s location settings exclude URLs containing the new query parameter (
-
Verify Audience and Goals
- Proceed to the Experience Summary to check and adjust the audience targeting for your experiment. Ensure the goals are properly set up to effectively measure the performance of variations against the original.
-
Add Domains to the Project Configuration
- If your variation URL's domain is different from the original, it must be added to the Project Configuration under "Active Websites" to ensure that the experiment runs correctly across all relevant domains.
Conclusion
Using regex in Split URL experiments facilitates precise manipulation of URL structures, allowing for detailed testing of web page variations with added query parameters. This method ensures accurate traffic direction and measurement, leading to more reliable and actionable insights.