WordPress Integration
Add qvctrs to WordPress using the theme customizer, a plugin, or by editing your theme files directly.
Easy3 minutes
Method 1: Theme Customizer (Easiest)
Many WordPress themes have a built-in option to add custom scripts.
- Go to Appearance → Customize
- Look for "Additional CSS/JS", "Custom Scripts", or similar
- Find the "Header Scripts" field
- Paste the qvctrs snippet:
<script>
window.qvctrs=window.qvctrs||{};window.qvctrs.q=window.qvctrs.q||[];
window.qvctrs.init=window.qvctrs.init||function(){window.qvctrs.q.push(['init'].concat(Array.prototype.slice.call(arguments)))};
window.qvctrs.init({siteId:'YOUR_SITE_ID'});
</script>
<script src="https://www.qvctrs.com/qvctrs-sdk-v2.js" async></script>- Click Publish
Method 2: Header/Footer Plugin
If your theme doesn't have script options, use a plugin.
Recommended plugins:
- Insert Headers and Footers by WPBeginner
- Header Footer Code Manager
- WPCode (formerly Insert Headers and Footers)
Steps:
- Install and activate one of the above plugins
- Go to Settings → Insert Headers and Footers (or similar)
- Paste the qvctrs snippet in the Header section
- Save changes
Method 3: Edit Theme Files
Use a Child Theme
Always edit a child theme to prevent losing changes on theme updates.
Option A: header.php
- Go to Appearance → Theme File Editor
- Select
header.phpfrom the right sidebar - Find the
</head>tag - Paste the snippet just before it:
<!-- qvctrs SDK -->
<script>
window.qvctrs=window.qvctrs||{};window.qvctrs.q=window.qvctrs.q||[];
window.qvctrs.init=window.qvctrs.init||function(){window.qvctrs.q.push(['init'].concat(Array.prototype.slice.call(arguments)))};
window.qvctrs.init({siteId:'YOUR_SITE_ID'});
</script>
<script src="https://www.qvctrs.com/qvctrs-sdk-v2.js" async></script>
</head>Option B: functions.php
Use WordPress hooks for cleaner integration:
// Add to functions.php or a custom plugin
function add_qvctrs_sdk() {
?>
<script>
window.qvctrs=window.qvctrs||{};window.qvctrs.q=window.qvctrs.q||[];
window.qvctrs.init=window.qvctrs.init||function(){window.qvctrs.q.push(['init'].concat(Array.prototype.slice.call(arguments)))};
window.qvctrs.init({siteId:'YOUR_SITE_ID'});
</script>
<script src="https://www.qvctrs.com/qvctrs-sdk-v2.js" async></script>
<?php
}
add_action('wp_head', 'add_qvctrs_sdk');Method 4: Using wp_enqueue_script
For developers who prefer WordPress best practices:
// Add to functions.php
function enqueue_qvctrs_sdk() {
// Add inline shim first
wp_add_inline_script(
'qvctrs-shim',
"window.qvctrs=window.qvctrs||{};window.qvctrs.q=window.qvctrs.q||[];" .
"window.qvctrs.init=window.qvctrs.init||function(){window.qvctrs.q.push(['init'].concat(Array.prototype.slice.call(arguments)))};" .
"window.qvctrs.init({siteId:'YOUR_SITE_ID'});"
);
// Enqueue the SDK
wp_enqueue_script(
'qvctrs-sdk',
'https://www.qvctrs.com/qvctrs-sdk-v2.js',
array(),
'2.4.0',
false // Load in head
);
// Add async attribute
add_filter('script_loader_tag', function($tag, $handle) {
if ('qvctrs-sdk' === $handle) {
return str_replace(' src', ' async src', $tag);
}
return $tag;
}, 10, 2);
}
add_action('wp_enqueue_scripts', 'enqueue_qvctrs_sdk');WooCommerce
For WooCommerce stores, use any of the methods above. The qvctrs SDK automatically captures e-commerce behaviors like:
- Product browsing and comparison patterns
- Add to cart hesitations
- Checkout form interactions
- Cart abandonment signals
Verify Installation
- Clear any caching plugins (WP Rocket, W3 Total Cache, etc.)
- Visit your site in an incognito window
- Open Developer Tools → Console
- Run
window.qvctrs.version— should show"2.4.0"
Checklist
- ✓Snippet added via customizer, plugin, or theme file
- ✓Site ID replaced with your actual ID
- ✓Cache cleared
- ✓Verified in browser console
Troubleshooting
Script not loading
- Check if a security plugin is blocking external scripts
- Verify the script isn't being minified/combined incorrectly
- Clear all caches (browser, plugin, CDN)
Conflicts with other plugins
The qvctrs SDK is designed to be non-intrusive and shouldn't conflict with other plugins. If you experience issues, check the browser console for errors.