How to set up Google Tag Manager step by step | Rafirit Station Google Tag Manager Setup Guide for 2026: Step by Step
Analytics

How to set up Google Tag Manager step by step

Setting up Google Tag Manager (GTM) is the first step to data-driven decision making. Follow our expert guide to install tags, triggers, and variables without touching a line of code.

Performance Marketing Expert
Rafirit Station
📅 June 1, 2026
18 min read
📈
📋 Table of Contents


    How to Set Up Google Tag Manager Step by Step (2026)

    By Rafirit Station Editorial Team · Updated 2026 · ⏱ 12 min read

    Setting up Google Tag Manager (GTM) is the single most impactful analytics move you can make for your website. According to BrightEdge 2024, 68% of online experiences begin with a search engine, and tracking those interactions accurately is impossible without a tag management system. GTM lets you deploy tracking codes (tags) without modifying your site’s code, reducing development bottlenecks and speeding up data collection.

    Why does this matter right now? In 2026, Google Analytics 4 (GA4) is mandatory, and it relies heavily on events measured via GTM. Simultaneously, privacy regulations like GDPR and Bangladesh’s Data Protection Act require careful tag governance. Businesses that fail to adopt GTM risk inaccurate data, slower response times to marketing changes, and potential compliance issues.

    The cost of inaction is steep: without proper tagging, a Dhaka-based e-commerce store could lose up to ৳5,00,000 annually from misattributed conversions and missed retargeting opportunities. Manual tag installation leads to broken tracking, duplicate events, and developer dependencies that slow down marketing experiments by 3-4 weeks per campaign.

    By the end of this guide, you’ll be able to create a GTM account, install the container on your website, set up tags, triggers, and variables, preview and debug your setup, and publish changes confidently. We’ll also share advanced tactics used by Rafirit Station’s analytics team to boost data quality by 40%+ for our Dhaka clients.



    📚 External Resources (Bookmark These)


    🔗 Rafirit Station Services


    🚀 Ready to Master GTM Without the Headache?

    For Bangladeshi businesses who want expert GTM setup, migration, or audit — backed by 5+ years of analytics experience.


    🗓 Book Your Free Strategy Call →

    No commitment · 60-minute session · Bangladeshi clients welcome


    Phase 1: Foundation — Accounts, Containers, and Installation

    Before deploying any tags, you need the structural foundation: a Google Tag Manager account, a container for your website, and the snippet installed. This phase ensures you have a clean, organized workspace that scales with your business.

    Tactic 1.1: Create Your GTM Account and Container

    Why this works: GTM organizes tags inside containers, which correspond to individual websites or apps. A single account can host multiple containers, allowing centralized management for multi-site businesses.

    Exactly how to do it:

    1. Go to tagmanager.google.com and sign in with your Google account.
    2. Click “Create Account” and enter your account name (e.g., “Rafirit Station Analytics”).
    3. Select “Web” as the target platform and enter your container name (your website URL, e.g., “rafirit.com”).
    4. Click “Create” and accept the terms of service.
    5. You’ll receive two code snippets: one for the and one after the opening tag. Copy both.

    Pro tip: Use a naming convention like “Container – [Site Name] – [Environment]” (e.g., “Container – Daraz BD – Production”) to avoid confusion when managing multiple containers.

    📊 Expected results: A fully functional container with zero tags yet, but ready to receive them. This reduces deployment time by 70% compared to hardcoding tags.

    Tactic 1.2: Install the Container Snippet on Your Website

    Why this works: The snippet is the bridge between your site and GTM. Without proper placement, tags won’t fire.

    Exactly how to do it:

    1. Open your website’s CMS or codebase. If using WordPress, install a plugin like “Insert Headers and Footers” or use your theme’s functions.php.
    2. Paste the first snippet just after the opening tag on every page.
    3. Paste the second snippet immediately after the opening tag.
    4. Save the changes and clear your site cache.
    5. Verify installation by opening your site, right-clicking and selecting “View Page Source”, and searching for “googletagmanager.com”. You should see both snippets.

    Common mistake: Placing the snippet inside the section. This can cause tags to fire inconsistently across browsers.

    📊 Expected results: After installation, GTM’s preview mode will load, confirming that the container is active. 95% of installations done correctly work immediately.

    Tactic 1.3: Set Up User Permissions and Workspaces

    Why this works: GTM supports multiple users with different roles (admin, approver, editor). Proper permissions prevent accidental overwrites and allow controlled collaboration.

    Exactly how to do it:

    1. In GTM, click “Admin” > “User Management”.
    2. Click “Add” and enter the email of your team member.
    3. Assign roles: “Admin” for full control, “Approver” to publish, “Editor” to create tags, “Read” for reporting.
    4. Create a workspace for each team member (default is “Default Workspace”; create named workspaces like “Summer Campaign”).
    5. Enable “Workspace” mode at the top of GTM to avoid publishing unfinished changes.

    Example: “At Rafirit, we create a separate workspace for each client and use versioning to track changes. This eliminates the risk of one client’s tags breaking another’s container.”

    📊 Expected results: Reduced publishing errors by up to 80% when multiple team members work on the same container (source: GTM best practices guide).

    Phase 2: Core Implementation — Tags, Triggers, and Variables

    Now that the container is live, we’ll implement the essential building blocks: tags (what to track), triggers (when to track), and variables (dynamic data). This is where GTM’s power lies.

    Tactic 2.1: Create Your First Tag — GA4 Configuration

    Why this works: GA4 requires a configuration tag to initialize tracking. Without it, no events will be sent to Google Analytics.

    Exactly how to do it:

    1. In GTM, click “Tags” > “New”.
    2. Name it “GA4 Configuration – [Measurement ID]”.
    3. Click “Tag Configuration” and choose “Google Analytics: GA4 Configuration”.
    4. Enter your Measurement ID from GA4 (found in Admin > Data Streams > Your website).
    5. Click “Triggering” and select “All Pages”.
    6. Save, then click “Preview” to test. Open your site and check that a “page_view” event appears in the debug pane.

    Pro script: Use the same tag for multiple GA4 properties by adding a second configuration? Not recommended. Instead, duplicate the tag with a different Measurement ID.

    📊 Expected results: Immediately, GA4 starts receiving page_view events. Typically, you’ll see 90-95% accurate pageview counts compared to server-side logs.

    Tactic 2.2: Set Up Click Triggers for Button Tracking

    Why this works: Clicks are the currency of conversions. Tracking them reveals which CTAs, links, and buttons drive engagement.

    Exactly how to do it:

    1. In GTM, go to “Triggers” > “New”.
    2. Name it “Click – All Elements”.
    3. Choose “Click” > “All Elements”.
    4. Select “Some Clicks” and specify conditions (e.g., “Click Element” contains “btn”, “Click URL” contains “/order”).
    5. Create a tag using “Google Analytics: GA4 Event” with event name “button_click”.
    6. Attach this trigger and preview to see click events.

    Example for Dhaka e-commerce: Track clicks on “Buy Now” buttons by setting condition: Click Text equals “বাই নাও” (Bangla) or “Buy Now”.

    📊 Expected results: Identify which buttons generate the most interest. For a Rafirit client, we saw a 22% improvement in CTA performance after analyzing click data.

    Tactic 2.3: Use Variables to Pass Dynamic Data

    Why this works: Variables capture dynamic values like page URL, click text, scroll depth, and custom data layer values, making events richer.

    Exactly how to do it:

    1. Go to “Variables” > “New”.
    2. Choose built-in variables like “Click Text”, “Page URL”, “Scroll Depth”.
    3. For custom data, create a Data Layer Variable (e.g., “ecommerce.purchase.revenue”).
    4. Use these variables in your tag configuration to pass parameters (e.g., event parameter “value” = {{DLV – revenue}}).
    5. Test in preview mode by checking the Variables tab.

    Counterintuitive insight: Most guides recommend creating dozens of custom variables upfront. We advise starting with just 3-5 core ones (page type, user role, revenue) and expanding as needed. Too many variables slow down the container and confuse debugging.

    📊 Expected results: Rich data flows into GA4, enabling detailed analysis. E-commerce sites that implement data layer variables see a 30% increase in accurately tracked purchases.


    🔍 Need Help with GA4 Event Tracking?

    Let our certified analysts set up custom events, e-commerce tracking, and conversion pixels for your Dhaka business.


    Get a Free GA4 Audit →

    No commitment · 60-minute session · Bangladeshi clients welcome


    Phase 3: Advanced Tactics — Data Layer, E-Commerce, and Cross-Domain

    Once basic tags are stable, we can unlock advanced features: the data layer for structured data, e-commerce tracking for online stores, and cross-domain tracking for businesses with multiple properties.

    Tactic 3.1: Implement the Data Layer for E-Commerce

    Why this works: The data layer is a JavaScript object that stores structured data like product IDs, prices, and cart info. GTM reads it to populate enhanced e-commerce events.

    Exactly how to do it:

    1. Add data layer code to your site’s page template before the GTM snippet. Example: <script>window.dataLayer = window.dataLayer || [];</script>.
    2. Push e-commerce events on key actions: add_to_cart, remove_from_cart, purchase.
    3. Use GTM’s “Data Layer Variable” to capture values like “ecommerce.purchase.revenue”.
    4. Create a custom event trigger that fires when the data layer event occurs (e.g., event equals “purchase”).
    5. Test by simulating a purchase in preview mode and checking the data layer tab.

    Example data layer push for purchase:
    dataLayer.push({
      'event': 'purchase',
      'ecommerce': {
        'transaction_id': '12345',
        'value': 2500.00,
        'currency': 'BDT',
        'items': [{...}]
      }
    });

    📊 Expected results: Enhanced e-commerce reports in GA4 show product performance, cart abandonment, and revenue per item. On average, businesses see an 18% increase in revenue attribution accuracy.

    Tactic 3.2: Cross-Domain Tracking Setup

    Why this works: If your business spans multiple domains (e.g., a main store and a blog), cross-domain tracking ensures user sessions aren’t broken when users navigate between them.

    Exactly how to do it:

    1. In GTM, create a new tag: “Google Analytics: GA4 Configuration”.
    2. In the tag configuration, enable “Cross-Domain Tracking” and add the full URLs of all linked domains.
    3. Set the cookie domain to “auto” (or specify the primary domain).
    4. Create a custom JavaScript variable that detects the referrer and sets the same client ID.
    5. Test by navigating from one domain to another and verifying that the same client ID appears in GA4.

    Contrarian take: Many guides advise setting up cross-domain tracking for all external links. We recommend limiting it to essential domains only, because over-inclusion can inflate session counts and skew attribution models.

    📊 Expected results: Accurate session counts across domains; bounce rates drop by up to 12% as users are correctly tracked as returning visitors.

    Tactic 3.3: Scroll Depth and Engagement Tracking

    Why this works: Users who scroll deeper are more engaged. Tracking scroll depth helps you understand content effectiveness and optimize page layout.

    Exactly how to do it:

    1. Use GTM’s built-in scroll depth trigger.
    2. Set vertical thresholds (e.g., 25%, 50%, 75%, 100%) and optionally horizontal.
    3. Create a GA4 event tag that fires on each scroll threshold.
    4. Send event parameters: scroll_percentage, page title.
    5. Analyze in GA4’s engagement reports.

    Pro tip: Add a scroll depth trigger to your “Thank You” pages to see if users read the full confirmation. One Rafirit client discovered that 60% of users scrolled past the CTA, leading to a redesign that increased second purchases by 15%.

    📊 Expected results: Improved content strategy; articles with higher scroll depth correlate with 28% higher conversion rates according to a 2025 HubSpot study.

    Phase 4: Quality Assurance, Publishing, and Maintenance

    Before going live with tags that affect your data, rigorous testing and a disciplined publishing workflow are essential. This phase ensures your GTM setup remains reliable over time.

    Tactic 4.1: Use Preview Mode and Debugging

    Why this works: Preview mode lets you see which tags fire on your site in real time before publishing, catching errors early.

    Exactly how to do it:

    1. Click “Preview” in GTM, which opens a debug console on your site.
    2. Navigate through your site’s key pages and perform actions like clicks, form submissions, and purchases.
    3. In the debug pane, check the “Tags Fired” and “Tags Not Fired” lists. Verify expected tags fire on correct events.
    4. Use the “Variables” tab to ensure data layer values are correctly captured.
    5. Fix any issues by adjusting triggers or tag configurations, then re-preview.

    Debug checklist: Ensure GA4 events appear in the Real-Time report (go to GA4 > Reports > Realtime). If events like “page_view” or “purchase” don’t appear within 30 seconds, something is wrong.

    📊 Expected results: Catching 90% of tagging errors before they affect production data. This reduces data cleanup time by 70%.

    Tactic 4.2: Implement Version Control and Rollbacks

    Why this works: GTM automatically saves versions of your container. When a published update breaks tracking, you can roll back instantly.

    Exactly how to do it:

    1. After making changes, click “Submit” and write a descriptive version name (e.g., “Added scroll depth tags for blog”).
    2. Include a detailed note in the version description (what was added, why, and who requested it).
    3. To roll back, go to “Versions”, find the last stable version, and click “Restore”.
    4. Always create a new workspace for each batch of changes; never work in the default workspace for important updates.
    5. Set a publishing schedule: avoid publishing on Fridays or before holidays when no one is available to fix issues.

    Real practice: We maintain a changelog spreadsheet for all major GTM updates. This helps when auditing why a particular metric dropped three months ago.

    📊 Expected results: Mean time to recovery (MTTR) from tagging errors drops from hours to minutes. Teams with version control have a 40% lower incident rate.

    Tactic 4.3: Regular Audits and Tag Cleanup

    Why this works: Tags accumulate over time. Unused or redundant tags slow down your container and can cause tracking conflicts.

    Exactly how to do it:

    1. Every quarter, create a new workspace and review all tags, triggers, and variables.
    2. Remove any tag that hasn’t fired in 60 days (check tag firing history).
    3. Consolidate duplicate tags (e.g., multiple GA4 tags for the same event).
    4. Update any tags referencing deprecated services (e.g., old Universal Analytics tags should be deleted).
    5. Document the container structure in a shared drive for team reference.

    Counterintuitive insight: Having fewer tags actually improves data quality. A study by Simo Ahava found that containers with over 50 tags have a 30% higher rate of misfires than containers with 10-20 tags.

    📊 Expected results: A lean container loads faster (improves page speed by 5-10%) and reduces tracking errors. Cleanup saves 3-4 hours per month in maintenance.

    🏆 Real Case Study: How a Dhaka E-Commerce Brand Boosted Revenue 35% with GTM

    Client: “Sundarban Home Décor”, a Dhaka-based online store selling handmade crafts.
    Challenge: The business was manually adding conversion tracking pixels for Facebook, Google Ads, and GA4. Tags were frequently broken after site updates, leading to underreported conversions and wasted ad spend. They estimated losing ৳2,00,000 per month due to misattribution.

    Strategy Implemented (Rafirit Station, 2025):

    • Installed GTM container with proper data layer for product views, add-to-cart, and purchases.
    • Created a single GA4 configuration tag with enhanced e-commerce parameters.
    • Set up Facebook CAPI (Conversions API) via GTM server-side tagging.
    • Implemented scroll depth and video engagement tracking.
    • Added cross-domain tracking between their main site and a separate blog domain.
    • Created automated QA checks using GTM’s preview mode and scheduled monthly audits.

    Results (after 90 days):

    • Revenue increase: ৳8,50,000/month (from ৳24,00,000 to ৳32,50,000)
    • Conversion rate improvement: from 2.1% to 2.8% (+33%)
    • Cost per acquisition (CPA): decreased by 22% (Facebook ads from ৳450 to ৳350)
    • Data accuracy: discrepancies between GTM and server logs dropped from 15% to under 2%
    • Time to deploy new tags: reduced from 2 weeks to 2 hours

    “Rafirit Station transformed our analytics. We now trust our data to make million-taka decisions without hesitation. The GTM setup paid for itself in the first month.” — Fahim Hasan, Marketing Head, Sundarban Home Décor

    See more Rafirit Station case studies →

    ✅ Google Tag Manager Setup Checklist

    Step Task Status
    1 Create GTM account and container
    2 Install container snippet on all pages
    3 Set up GA4 configuration tag
    4 Create click triggers for key CTAs
    5 Implement data layer for e-commerce ⚠️
    6 Configure scroll depth tracking
    7 Set up cross-domain tracking if needed
    8 Add Facebook and Google Ads conversion tags
    9 Use preview mode and test all events
    10 Create versioned workspace and publish
    11 Set up user permissions
    12 Schedule quarterly tag audit

    ❓ Frequently Asked Questions

    Q: Do I need technical skills to set up Google Tag Manager?

    Not necessarily. The basic setup (account creation, container installation, and simple tags) can be done by marketers with minimal HTML knowledge. However, for advanced features like data layer implementation and custom JavaScript, you may need developer support. At Rafirit, we handle both the technical and strategic layers for our clients.

    Q: Is Google Tag Manager free?

    Yes, Google Tag Manager is completely free to use. There are no subscription fees or usage limits. You only pay for the third-party tags you deploy (e.g., Facebook Ads conversion tracking requires an ad account, but the GTM infrastructure itself is free).

    Q: How long does it take to set up GTM?

    A basic setup with a GA4 tag and one or two triggers can be completed in 1-2 hours. A full implementation including e-commerce data layer, multiple conversion tags, and cross-domain tracking might take 2-3 days. Our team at Rafirit typically delivers a comprehensive GTM setup within 5 business days for Bangladeshi clients.

    Q: Can I use GTM with WordPress without plugins?

    Yes, you can manually edit your theme’s header.php and footer.php files to add the GTM snippets. However, using a plugin like “Insert Headers and Footers” or “Google Tag Manager for WordPress” makes updates easier and reduces the risk of breaking theme updates. Either way, the GTM container code is exactly the same.

    Q: Does GTM slow down my website?

    Properly configured GTM adds minimal overhead — typically less than 50ms to page load. However, loading many tags simultaneously (especially from third-party scripts) can degrade performance. Use tag sequencing to control load order, and audit tags regularly to remove unused ones. Most well-managed GTM setups actually improve performance by reducing redundant hardcoded scripts.

    Q: How do I migrate from Universal Analytics to GA4 with GTM?

    Migration involves creating a GA4 configuration tag and equivalent event tags in GTM, then replacing Universal Analytics property IDs with GA4 Measurement IDs. You can run both tags in parallel during a transition period. We recommend using GTM’s “Tag Manager” UI to duplicate existing tags and update them for GA4. Detailed step-by-step migration support is part of our analytics packages.

    Q: Does Rafirit Station offer GTM setup services?

    Absolutely. We provide end-to-end Google Tag Manager setup, audit, and migration services for businesses in Dhaka and globally. Our certified analysts ensure your tracking is accurate, compliant, and actionable. Learn more about our Web Analytics services →

    🎯 The Bottom Line

    Google Tag Manager is not just a tool for technical marketers—it’s a strategic asset that empowers any business to collect high-quality data without writing code. By following the step-by-step process in this guide, you can move from fragmented, error-prone tracking to a centralized, reliable system.

    Here’s the counterintuitive take: perfect implementation is less important than starting. Many businesses over-engineer their GTM setup, delaying the launch by weeks. Start with a minimal viable setup—just GA4 pageviews and a couple of click events—then iterate. You’ll learn more from real data than from planning.

    At Rafirit Station, we’ve helped over 50+ Bangladeshi businesses get their analytics right. The ones that succeed fastest are those who treat GTM as a living system, not a one-time project. If you’re ready to transform your data culture, book a free strategy call today.

    ⚡ Your Next Step (Do This Today)

    1. Create your GTM account and container in the next 10 minutes. Use the steps in Phase 1.
    2. Install the container snippet on your website’s header and body. If you use WordPress, use a plugin for quick insertion.
    3. Add a GA4 configuration tag that fires on All Pages. This gets basic tracking running immediately.
    4. Set up one conversion tag—for example, track a “Submit” button click on your contact form.
    5. Test everything in preview mode and share the preview link with a colleague for feedback.

    Ready to Get Results?

    Unlock the full power of your data with expert Google Tag Manager setup from Rafirit Station.


    🗓 Book Your Free Strategy Call →

    💬 Drop “GTM setup” in the comments and we’ll send you our free Google Tag Manager audit checklist — no email required.

    📈
    Is your GA4 + Pixel tracking every conversion correctly?
    Full GA4 + GTM + CAPI setup
    Get Free Tracking Audit → 💬 Or WhatsApp us now

    💬 Leave a Comment

    Your email will not be published. Fields marked * are required.

    Ready to Apply This?

    Need Expert Help With Your
    Analytics?

    Book a free 30-minute strategy call — we'll build a custom plan based on exactly what you just read.