This guide walks you through the full setup of Code Cube's Tag Monitor using Google Tag Manager.
What will you do?
- Configure your domains and containers in the Code Cube portal
- Import the Tag Monitor template into GTM
- Set up the tag with sampling and metadata
- Publish and verify your implementation
⏰ Estimated time: 10 - 15 minutes
🔧 Requirements: Access to Google Tag Manager (preferably admin) and Code Cube portal
Implementation
- Step 1 – Portal configuration
- Step 2 – Import template in GTM
- Step 3 – Configure the tag in GTM
- Step 4 – Configure tag metadata
- Step 5 – Deploy and verify
Step 1 – Portal configuration
Before configuring anything in GTM, define which domains and containers should be monitored with Code Cube’s Tag Monitor.
1.1 Domains & Time zone
- Go to the step 'General settings' on the Tag Monitor configuration page
- Add all domains you want to monitor
- Select the appropriate time zone
Important: Alerts and data will only be available for domains listed here. If your domain is not added, Tag Monitor won’t process any data.
1.2 GTM container settings
- Go to the step 'Client-side error monitoring’ on the Tag Monitor configuration page
- Add the GTM container IDs you want to enable monitoring for
Important: Alerts and data will only be available for domains listed here. If your domain is not added, Tag Monitor won’t process any data.
Step 2 – Import Code Cube template in GTM
Install the Tag Monitor tag template in your GTM container. This provides the logic needed to send tag data to Code Cube.
2.1 Download the template
- Go to 'Client-side error monitoring' in the Tag Monitor configuration page
- Click "Download template"
2.2 Import template to GTM
- Open your GTM container
- Go to "Templates" > "Tag Templates"
- Click "New"
- Click the three dots > "Import"
- Upload the downloaded file
- Save without making any changes
Step 3. Configure the tag in GTM
Now configure how the Tag Monitor tag collects and sends data — including basic settings and sampling.
3.1 Create the tag
- Create a new tag
- Choose the imported Tag Monitor template as the tag type.
- Fill in the required fields:
- Database name: Copy from the configuration page
- Consent: Set to 'No additional consent required’.
- Metadata: Add key
exclude
with valuetrue
3.2 Set-up the trigger
Use a Custom Event trigger with regex matching and optional sampling to control data volume.
- Create a new trigger
- Trigger type: Custom Event
- Event name:
.*
(match all) - Enable "Use regex matching"
You can add sampling to the trigger, which will help to minimze the impact on performance for high-traffic environments.
- Enable the built-in variable "Random Number"
- Add a condition to only fire the tag when
Random Number
matches your sampling logic
Recommended Sampling Rates:
segment of 0.5% | random number | less then or equal to | 10737418 |
segment of 5% | random number | less then or equal to | 107374182 |
segment of 10% | random number | ends on | 1* |
segment of 20% | random number | less then or equal to | 429496729 |
segment of 25% | random number | less then or equal to | 536870911 |
segment of 50% | random number | less then or equal to | 1073741823 |
3.3 Enable required variables
Some built-in variables should be enabled, as these are used by Tag Monitor to identify the container the tag was fired from.
- Go to Variables > Built-in Variables
- Enable:
- Container ID
- Container Version
4. Configure Tag metadata
Add your tag names to the outgoing requests for easier debugging and reporting.
Option A: Automatic update (Recommended)
- Go to 'Configure tag names' on the configuration page
- Click Start bulk editing
- Follow the guided process to update your GTM container via API
Option B: Manual Update
For each tag in your container:
- Open Advanced Settings
- Check "Include tag name" under Additional Metadata
- Set key name to
name
Step 5 – Deploy and verify
Once everything is configured, it’s time to go live and confirm everything works as expected.
5.1 Publish changes
- Submit and publish your GTM workspace
- Choose the right environment (usually production)
5.2 Verify
- Open the Tag Monitor dashboard in the Code Cube portal
- Look for incoming data from your configured domain and container
- Check that tag names are being registered correctly
Troubleshooting
No data in dashboard | Check that trigger conditions are met; verify sampling rate isn't too low |
Missing tag names | Ensure metadata is configured for all tags |
Performance issues | Consider reducing sampling rate if site speed is affected |
Template import fails | Download template again; check for browser extensions blocking import |