⚙️ GTM Script Library
11 copy-paste JavaScript scripts for Google Tag Manager, optimized for B2B funnels and conversion tracking.
Complete Source Code
Ready-to-use JavaScript code blocks for immediate GTM implementation
GTM Setup Guide
Step-by-step instructions for configuring each script in Google Tag Manager
Real Use Cases
Practical examples and configuration options for your specific needs
Dynamic UTM Parameter Capture
Campaign Attribution Foundation
Captures UTM parameters from URL, stores in localStorage, and pushes to dataLayer for persistent campaign attribution and session tracking.
Difficulty
BeginnerCategory
Foundation
Use Case
Perfect for B2B websites that need persistent campaign attribution across sessions
Key Features
- ✓URL parameter extraction
- ✓localStorage persistence
- ✓DataLayer integration
- ✓Session management
Implementation
Traffic Source Mapper
Comprehensive Source Attribution
Captures first visit source, interaction level, and logs with timestamp for comprehensive traffic source analytics.
Difficulty
BeginnerCategory
Foundation
Use Case
Essential for understanding true traffic source attribution and customer journey mapping
Key Features
- ✓First-touch attribution
- ✓Source classification
- ✓Interaction logging
- ✓Timestamp tracking
Implementation
UTM Transfer Script
Parameter Preservation
Transfers UTM parameters to all outbound or internal links for complete attribution tracking across domains.
Difficulty
BeginnerCategory
Foundation
Use Case
Crucial for multi-page funnels and external link tracking without losing campaign data
Key Features
- ✓Link attribution
- ✓Parameter preservation
- ✓Cross-domain tracking
- ✓Attribution continuity
Implementation
Time-of-Day Behavioral Tagger
Temporal Visitor Segmentation
Segments visitors by time of day and pushes time_segment to dataLayer for behavioral analysis.
Difficulty
IntermediateCategory
Tracking
Use Case
Great for businesses with time-sensitive offers or different messaging for business hours
Key Features
- ✓Time-based segmentation
- ✓Behavioral tagging
- ✓DataLayer events
- ✓Temporal analytics
Implementation
Video Engagement Tracker
YouTube Milestone Tracking
Tracks engagement on YouTube videos: play, pause, 25%, 50%, 75%, 100% completion rates with detailed analytics.
Difficulty
IntermediateCategory
Tracking
Use Case
Perfect for SaaS companies with product demo videos or educational content
Key Features
- ✓YouTube API integration
- ✓Milestone tracking
- ✓Engagement analytics
- ✓Demo video insights
Implementation
Form Abandonment Tracker
CRO Diagnostics
Tracks if users start filling a form but don't submit within specified time for conversion rate optimization.
Difficulty
IntermediateCategory
Engagement
Use Case
Essential for identifying friction points in lead generation forms and checkout processes
Key Features
- ✓Form interaction detection
- ✓Abandonment timing
- ✓Field-level tracking
- ✓Drop-off analysis
Implementation
Live Session Intent Scorer
Real-time Intent Classification
Monitors scroll depth, clicks, and time on page to classify visitor intent as low, medium, or high in real-time.
Difficulty
AdvancedCategory
Engagement
Use Case
Perfect for sales teams to prioritize leads and trigger personalized outreach based on behavior
Key Features
- ✓Behavioral scoring
- ✓Intent classification
- ✓Real-time analysis
- ✓Engagement metrics
Implementation
Smart UTM-Based Content Swapper
Dynamic Content Personalization
Dynamically swaps content like headlines, CTAs, or images based on UTM parameters for personalized experiences.
Difficulty
IntermediateCategory
Personalization
Use Case
Ideal for campaign-specific landing pages and personalized user experiences
Key Features
- ✓Dynamic content switching
- ✓UTM-based logic
- ✓A/B testing support
- ✓Campaign customization
Implementation
Dynamic Testimonial Switcher
Industry-Based Social Proof
Changes testimonial blocks or client logos based on utm_industry or persona tags for relevant social proof.
Difficulty
IntermediateCategory
Personalization
Use Case
Perfect for B2B companies serving multiple industries with different use cases
Key Features
- ✓Industry targeting
- ✓Persona-based content
- ✓Social proof optimization
- ✓Dynamic testimonials
Implementation
Visitor Frequency Personalizer
Return Visitor Optimization
Tracks visit frequency and personalizes content for returning visitors with progressive messaging strategies.
Difficulty
IntermediateCategory
Personalization
Use Case
Great for nurturing prospects through multiple touchpoints with escalating value propositions
Key Features
- ✓Visit frequency tracking
- ✓Returning visitor logic
- ✓Progressive messaging
- ✓Engagement escalation
Implementation
Weather/Geo-based Personalizer
Location-Aware Content
Fetches geolocation and weather data to tailor messaging based on visitor location and weather conditions.
Difficulty
AdvancedCategory
Personalization
Use Case
Perfect for location-specific offers, weather-dependent products, or regional messaging
Key Features
- ✓Location detection
- ✓Weather API integration
- ✓Geographic personalization
- ✓Contextual messaging