Back to Installation
Google Tag Manager Installation Guide
Step-by-step guide to install TwoBucks Analytics via Google Tag Manager.
Quick Start
Method 1: Custom HTML Tag (Recommended)
- Go to Tags → New
- Configure:
- Tag Type: Custom HTML
- Tag Name: TwoBucks Analytics
- HTML:
<script
src="https://twobucks.ai/script.js"
data-website-id="your-website-id"
async
></script>- Triggering: All Pages
- Tag firing priority: Set to fire early (e.g., 1)
- Click Save
Track GTM Events
Custom Event Trigger
- Go to Triggers → New
- Configure:
- Trigger Type: Custom Event
- Event name: twobucks_track
- Click Save
- Create a Custom HTML Tag:
<script>
(function() {
var eventName = {{Event}};
var properties = {{Event Properties}} || {};
if (window.twobucks && eventName) {
window.twobucks(eventName, properties);
}
})();
</script>Triggering: Use the custom event trigger above
Data Layer Push
Push events to GTM data layer, then track with TwoBucks:
// Push to GTM
dataLayer.push({
'event': 'twobucks_track',
'twobucks_event': 'button_click',
'twobucks_properties': {
'button_name': 'Sign Up',
'page': window.location.pathname
}
});GTM Variables
Create variables for easier management:
- Go to Variables → New
- Configure:
- Variable Type: Constant
- Variable Name: TwoBucks Website ID
- Value: your-website-id
- Use in tags:
{{TwoBucks Website ID}}
Common Issues
Script Not Loading
- Check tag firing priority (set to fire early)
- Verify trigger is set to "All Pages"
- Check GTM preview mode for errors
- Ensure script URL is correct
Timing Issues
If events fire before script loads:
- Increase tag firing priority
- Use GTM's "DOM Ready" trigger instead of "All Pages"
- Add a small delay if needed
Duplicate Scripts
If script loads multiple times:
- Check for duplicate tags
- Verify trigger conditions
- Use tag firing priority to control order
Best Practices
- Use Constants: Store website ID in a GTM variable for easy updates
- Test in Preview: Always test in GTM preview mode before publishing
- Tag Priority: Set analytics tags to fire early (priority 1-10) for accurate tracking