Google Tag Manager Integration
Add qvctrs through GTM using a Custom HTML tag. Ideal for sites that manage all scripts through Tag Manager.
Step 1: Create a new tag
- Open Google Tag Manager
- Select your container
- Go to Tags → New
- Click Tag Configuration
- Choose Custom HTML
Step 2: Add the qvctrs snippet
Paste this code in the HTML field:
<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>Step 3: Configure the trigger
- Click Triggering
- Select All Pages (or create a custom trigger for specific pages)
- For best results, choose Page View - DOM Ready or Page View - Window Loaded
Trigger Timing
Using Initialization - All Pages ensures the earliest possible loading. However, the command queue pattern means any trigger timing will work correctly.
Step 4: Save and publish
- Name your tag (e.g., "qvctrs SDK")
- Click Save
- Click Submit to publish your changes
- Add a version name and click Publish
Advanced: Using GTM Variables
You can use GTM variables to manage your Site ID across environments:
Create a Constant Variable
- Go to Variables → New
- Choose Constant
- Set the value to your Site ID
- Name it
qvctrs_site_id
Reference in your tag
<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:'{{qvctrs_site_id}}'});
</script>
<script src="https://www.qvctrs.com/qvctrs-sdk-v2.js" async></script>Advanced: Conditional Loading
Load qvctrs only on specific pages or for specific users:
Example: Only on product pages
- Create a new trigger
- Trigger type: Page View
- Trigger fires on: Some Page Views
- Condition: Page Path contains
/product/
Example: Exclude internal traffic
- Create a Lookup Table variable for internal IPs
- Add an exception to your trigger
GTM Server-Side
For GTM Server-Side containers, you can load the SDK client-side and send data through your server container. The command queue pattern works the same way — just ensure the client-side snippet is in place.
Testing with GTM Preview
- Click Preview in GTM
- Enter your website URL
- Look for your "qvctrs SDK" tag in the Tags Fired section
- Open your site's console and run
window.qvctrs.version
Verify Installation
- Publish your GTM container
- Visit your website
- Open Developer Tools → Console
- Run
window.qvctrs.version— should show"2.4.0"
Checklist
- ✓Custom HTML tag created with qvctrs snippet
- ✓Site ID replaced with your actual ID
- ✓Trigger configured (All Pages or custom)
- ✓Container published
- ✓Verified in browser console
Troubleshooting
Tag shows as fired but SDK not working
Check that the Custom HTML tag doesn't have any typos. Also verify that no other tags or scripts are interfering with the window.qvctrs object.
Tag not firing
- Check your trigger conditions
- Verify GTM container is installed on the page
- Use GTM Preview mode to debug
Consent mode
If you use consent management, you can configure the qvctrs tag to only fire after consent is granted. Create a trigger based on your consent state variable.