Install the Widget Using Google Tag Manager
Deploy ViaSay's widget with precise control over URLs, device types, and user contexts using Google Tag Manager.
Why Use GTM?
Google Tag Manager provides advanced deployment control without modifying your website's codebase:
- URL targeting: Display the widget only on specific pages or sections
- Device filtering: Deploy different widgets for desktop vs mobile
- Language routing: Show language-specific widgets based on URL structure
- A/B testing: Activate different widget configurations for user segments
Prerequisites
ViaSay prerequisites
- Make sure you have created a ViaSay Widget
Deploy Invisible, Launch When Ready
Set Audience Distribution to 0% during setup. The widget code deploys to production but remains hidden. When ready to launch, adjust the percentage in Integration to control visibility—no code changes required.
Technical prerequisites
- Google Tag Manager installed on your website
- GTM container access with edit permissions
- Basic understanding of GTM concepts (tags, triggers, variables)
Installation Steps
Step 1: Create a Trigger
Triggers define when and where your widget loads.
- Navigate to Triggers in the left sidebar
- Click New
- Click the trigger configuration area
- Select Page View as the trigger type
- Configure the trigger scope:
Deploy on all pages:
- Select All Page Views
Deploy on specific URLs:
- Select Some Page Views
- Add condition:
Page URLcontains/your-path/
Example: Display widget only on FAQ pages:
'Display widget only on FAQ pages:'
Page URL contains /faq
'Display widget only on FR pages:'
Page URL contains /fr
- Name your trigger clearly (e.g., "Widget - All Pages", "Widget - FAQ Only", "Widget - Desktop FR")
- Click Save
Step 2: Create a Tag
Tags contain the actual widget code.
- Navigate to Tags in the left sidebar
- Click New
- Click the tag configuration area
- Select Custom HTML as the tag type
- Paste your ViaSay widget code (from Build > Integrate > Channels > Integration tab)
- Scroll to Triggering section
- Click to add a trigger
- Select the trigger(s) created in Step 1
- Name your tag (e.g., "ViaSay Widget", "ViaSay Widget - Desktop")
- Click Save
Step 3: Test and Publish
- Click Preview in the top-right corner
- Enter your website URL to launch debug mode
- Verify the widget loads on intended pages
- Check the Tags Fired section confirms your tag executed
- Click Submit to publish changes
- Add a version name and description
- Click Publish
Advanced Configurations
Target Specific Device Types
Create a custom JavaScript variable to detect device type:
- Navigate to Variables in the left sidebar
- Click New under User-Defined Variables
- Select Custom JavaScript as variable type
- Add this function:
function() {
return window.innerWidth <= 768 ? 'mobile' : 'desktop';
}
- Name it
deviceType - Create separate triggers for mobile and desktop:
- Trigger:
deviceTypeequalsmobile - Trigger:
deviceTypeequalsdesktop
- Trigger:
Deploy Multiple Widgets
Deploy different widget configurations by URL or context:
| Trigger Condition | Widget Use Case | |
|---|---|---|
Page URL contains /en/ | English widget | |
Page URL contains /fr/ | French widget | |
Page URL contains /support/ | Support-focused greeting | |
Page URL contains /pricing/ | Sales-focused widget |
Create separate tags with different widget tokens for each trigger.
Pass Custom Variables to Widget
Enrich conversations with user context using user channel variables. See User Channel Variables documentation →
Troubleshooting
| Issue | Solution | |
|---|---|---|
| Widget not loading | Check GTM preview mode confirms tag fired; verify trigger conditions match current page | |
| Widget loads on wrong pages | Review trigger configuration; ensure URL patterns match intended pages | |
| Multiple widgets appear | Check for duplicate tags or triggers; ensure only one widget tag fires per page | |
| GTM blocked by ad blockers | GTM is commonly blocked (uBlock, AdBlock Plus); ViaSay widget is rarely blocked; consider direct HTML installation for maximum reach | |
| Safari iOS 13+ blocking GTM | Implement Conversion Linker workaround to bypass ITP restrictions |
⚠️ Ad blocker impact: GTM is frequently blocked due to Google Analytics associations. If maximum widget visibility is critical, use direct HTML installation instead.
GTM vs Direct HTML Installation
| Metho | Method | Best For |
|---|---|---|
| GTM | Complex deployments with URL targeting, A/B testing, or device-specific widgets | |
| Direct HTML | Simple site-wide deployment with maximum reach and minimal ad blocker interference |
GTM Documentation
Next Steps
- Configure widget appearance in Format & Design
- Set up context-specific greetings in Greetings
- Pass user data with custom variables
- Monitor performance by URL segment in Monitor
Updated about 3 hours ago
