-
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
Variation Code FAQ
What's the difference between the 'code editor' and the 'custom javascript' editors? What does one do that the other does not?
The “Code Editor” lets you edit the code generated by the editor when you do changes using the right-click contextual menu options. In there you can also write code but it has to follow the guidelines explained at:
That code is executed multiple times until each line returned at least one DOM element or DOM ready is hit.
On the other hand, inside Custom JS you can add any standard JS code. That will run once, at the moment when the experiment is fired, which is usually somewhere in the head section of the page
Do you have examples that use the custom JS editor?
Any JS could go into there… But, if the code manipulates DOM elements, it has to be wrapped in a Dom ready call:
convert.$(document).ready(function() {
//code here
});
Does Custom JS have anything special from what standard JS developers write?
No there aren't any. Only that this code is written in English (UTF-8) and included on the page when the variation is shown.
But will I see any differences if I run my code via one or the other? I always wrap my code in convert.$( document.... ) etc - also when using the code editor
In that case, you will not see any difference...and you need to place the code inside the Custom JS area for best performance. But, in some cases, you might see some differences. For instance, if you have this line that changes an element
$("selector").text("new text");
if you write it in Code editor, will be:
convert._$("selector").text("new text")
and inside Custom JS would be
convert.$(document).ready(function() {
convert.$("selector").text("new text")
});
In the first case, when the experiment is presented, you will not see the text found initially in that block before the change is applied
In the second case, it's possible that for a short time you see the original text before it's changed by the code.
But inside Code editor, all code should be of the form in the first case:
convert._$("selector").action
Can i pass convert.$ as an argument like in the following?
convert.$(document).ready(function() {
//code here
});
does that make any difference?
Yes, sure you can. However, it does make a difference. In the first case, you use convert bundled jquery
When using the convert version of jQuery, do I need document ready?
Yes, you need DOM ready.
In both cases?
Yes.. in both cases. In the second case, you need to make sure that the jQuery is loaded on the page before Convert…
Usually, people use the on-page version when they have certain plugins attached to that like for instance a lightbox.
Why do I need a DOM-ready wrapper when my code is executed every 50 ms until there's nothing left inside the code that seems to need processing? It seems to be running before DOM ready.
That is the case only with code placed inside Code Editor, but code inside Code Editor has to use convert._$ and only that.
Why not use one code editor for all cases?
Mainly, the code inside the code editor is executed multiple times, until all convert._$ code lines inside will return at least one element. But if there's no convert._$ inside, then it will execute just once…
What if want to run some code only once inside the Code Editor?
You can do the following:
if(convert._$('selector').length>0) {
convert.$(selector1).action
}
And in this case, it will poll until the selector is found and then will look for selector1, but if that is not found it won't loop to look for it.
You can also do IF statements for nodes deep in the DOM that, when loaded, will ensure other nodes before they were already loaded and can be safely used in code.
Why do you use two libraries to achieve the same goal?
Because you cannot use:
if(convert._$('selector').length>0) {
convert._$(selector1).action
};
Since, if when the selector is found, selector1 will not be found. The code will loop but the second-time selector would not be found anymore as the code considers it already handled.
So, convert._$( document ).ready() is not really a document ready as I know it?
It is a modified jQuery, but in this statement will have the same effect.
convert.$(document).ready(function() {
(function($){
// do the magic
})(convert.$)
});
Or this if you do not want to rely on the jQuery loaded on the page.
So convert._$ designed to execute the code without DOM ready?
Yes, convert._$ is designed to work without DOM ready,
But only on simple instructions like:
convert._$(selector).action