- Help Center
- Developers
- Project Management
-
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
Project, Experience, Variation Javascript
This Article Will Help You:
- Overview
- Global Project JavaScript
- Global Experience JavaScript
- Variation JavaScript
- Calling Functions Declared There
Overview
Convert enables you to include JavaScript snippets as part of your Project, Experiment or even Variation.
Global Project JavaScript
Convert allows you to include a JS snippet in your Project. This means that all the pages that have the Convert tracking code installed will have the snippet included.
The snippet would be included just like any other library that you include in your web page.
You can edit the snippet by going to your Project Configuration.
Global Experience JavaScript
Convert Experiences allows you to insert a JavaScript snippet into a page when an experience is triggered. The snippet would be included just like any other library that you include in your web page. This only applies to experience types that include the Visual Editor (ie, you cannot do this with a Split URL Experiment).
To add JavaScript to your experience.
- Open the Visual Editor from the Experience Summary
- Click on the Snippet Editor icon.
- Select Global Experience JavaScript.
- Add the JavaScript snippet.
- Save your Experience.
The way the code is added to the page you are testing or personalizing would be equivalent to adding it to the head section inside a script tag.
Additionally, you could add JS events such as click or hover events for your code to trigger.
Variation JavaScript
Convert Experiences enables you to add a JavaScript snippet in the variation of your choice. This can only be done in experience types where the Visual Editor is available (ie, this is not possible in Split URL Experiences).
With this feature, you can test if certain functionality added by the snippet improves your conversion.
For example, you could A/B test customer support chat by adding the chat code to the Variation.
To add it:
- Open the Visual Editor from the Experience Summary
- Click on the Snippet Editor icon.
- Select Variation JavaScript
- Add your code in the editor.
The code added here will not run automatically. You would need an event to run it just as you would with any included JS library.
Calling Functions Declared There
To call a function declared in the Global Project JavaScript or the Global Experience JavaScript sections, just declare it in the following way:
// You can define the function as
window.functionName = function() {
//code here
}
// and than call it like
window.functionName()
// or
functionName();