How to Set Up GTM for Your E-Commerce Store: A Step-by-Step Guide for Indian Merchants
If you run an e-commerce store in India, you already know that every click, cart addition, and checkout matters. But without proper tracking, you’re essentially flying blind. Google Tag Manager (GTM) is the free, powerful tool that bridges the gap between your website data and your marketing decisions. In this comprehensive guide, we’ll walk you through exactly how to set up GTM for your e-commerce store—from container creation to advanced tracking—so you can make data-driven decisions that boost your ROI.
Whether you’re a small D2C brand in Delhi or a large marketplace in Mumbai, implementing google tag manager ecommerce tracking correctly can be the difference between a 5% and a 15% conversion rate. Let’s dive in.
Why GTM is Essential for E-Commerce Success
Before we get into the technical steps, understand why GTM matters. Traditional tag management involves editing your website’s code every time you want to add a new tracking pixel. For an e-commerce store, that means constant developer intervention for Facebook Pixel, Google Ads conversion tracking, analytics events, and more.
GTM eliminates this bottleneck. It acts as a central hub where you can deploy and manage all your marketing tags without touching a single line of code after the initial setup. For Indian businesses, where developer costs can range from ₹15,000 to ₹50,000 per month, this translates to significant savings.
Moreover, google tag manager ecommerce setup allows you to track critical events like:
- Product views
- Add-to-cart actions
- Checkout steps
- Purchases with revenue data
- User engagement metrics
Without GTM, you’re likely missing out on 30-40% of your potential data, especially on dynamic e-commerce sites.
Prerequisites: What You Need Before Starting
Setting up GTM for your e-commerce store requires a few foundational elements. Here’s your checklist:
- A Google Tag Manager account – Create one at tagmanager.google.com using your Google account.
- A Google Analytics 4 (GA4) property – This is the modern analytics platform that works seamlessly with GTM.
- Access to your website’s backend – You’ll need to paste the GTM container code into your site’s header.
- Basic understanding of your e-commerce platform – Shopify, WooCommerce, Magento, or custom-built.
- DataLayer knowledge (optional but recommended) – The DataLayer is a JavaScript variable that GTM uses to capture e-commerce events.
For Indian merchants using platforms like Shopify or WooCommerce, most of the heavy lifting is already done. But custom sites require more manual work.
Step 1: Create Your GTM Container and Install It
Start by logging into your GTM account and clicking “Create Account.” Enter your business name (e.g., “AK Network Solutions Client – Delhi E-Commerce”) and select “Web” as the target platform.
Once created, you’ll receive two code snippets:
- Container snippet (head) – Paste this in the
<head>section of every page. - Container snippet (body) – Paste this immediately after the opening
<body>tag.
Pro tip for Indian merchants: If you’re using a CMS like WordPress with a theme editor, install a plugin like “Insert Headers and Footers” to avoid manual code edits. For Shopify, paste the head snippet in the theme.liquid file under <head>.
After installation, use the GTM Preview mode to verify the container is firing. You should see a GTM debug panel at the bottom of your site.
Step 2: Set Up the DataLayer for E-Commerce Events
The DataLayer is the backbone of google tag manager ecommerce tracking. It’s a structured data object that passes information like product name, price, quantity, and transaction ID to GTM.
For most e-commerce platforms, the DataLayer is automatically populated. Here’s a typical purchase event example:
window.dataLayer.push({
event: 'purchase',
ecommerce: {
transaction_id: 'INV-2025-001',
value: 2500.00,
currency: 'INR',
items: [{
item_name: 'Kurti Set',
item_id: 'KS-123',
price: 1250.00,
quantity: 2
}]
}
});
If your platform doesn’t push DataLayer events automatically, you’ll need to add them manually. For WooCommerce, use a plugin like “GTM DataLayer for WooCommerce.” For Shopify, enable “Additional Google Analytics code” in your store settings and ensure the DataLayer is enabled.
Actionable tip: Test your DataLayer using GTM Preview mode. Look for the “DataLayer” tab in the debug panel to confirm events are firing correctly.
Step 3: Create Tags for Key E-Commerce Events
Now that your DataLayer is live, it’s time to create tags. Tags are the snippets of code (like Google Analytics, Facebook Pixel, or Google Ads) that fire based on triggers.
3.1 Google Analytics 4 (GA4) Configuration Tag
Create a new tag of type “Google Analytics: GA4 Configuration.” Enter your GA4 Measurement ID (found in GA4 Admin > Data Streams). Set the trigger to “All Pages.”
This tag sends pageview data to GA4 and enables event tracking.
3.2 GA4 E-Commerce Events Tag
Create a new tag of type “Google Analytics: GA4 Event.” Set the event name to “purchase” (or “add_to_cart,” “view_item,” etc.). Under “Event Parameters,” map the DataLayer variables:
value→{{DLV - ecommerce.value}}currency→INRitems→{{DLV - ecommerce.items}}
Set the trigger to fire on the “purchase” DataLayer event.
Repeat for other events like “add_to_cart,” “view_item,” and “begin_checkout.”
3.3 Facebook Pixel Tag
Create a new tag of type “Custom HTML.” Paste your Facebook Pixel base code. For event-specific tracking, use the fbq('track', 'Purchase', ...) function within a tag that fires on the purchase DataLayer event.
India-specific note: Facebook is the dominant social platform for Indian e-commerce, with over 450 million users. Proper pixel tracking through GTM can reduce cost-per-purchase by 20-30%.
Step 4: Set Up Triggers and Variables
Triggers tell your tags when to fire. For e-commerce, you’ll use:
- Custom Event triggers – Fire on DataLayer events like “purchase,” “add_to_cart,” etc.
- Click triggers – Fire when users click specific elements (e.g., “Add to Cart” buttons).
- Page View triggers – Fire on specific URLs (e.g., “/thank-you” for purchase confirmation).
Variables are placeholders for dynamic data. Create DataLayer Variables for:
ecommerce.transaction_idecommerce.valueecommerce.items
To create a DataLayer Variable in GTM: Go to Variables > User-Defined Variables > New > Data Layer Variable. Enter the key name (e.g., “ecommerce.transaction_id”).
Pro tip: Use GTM’s built-in click variables (Click URL, Click Text) for tracking button clicks if DataLayer events aren’t available.
Step 5: Test and Debug Your Implementation
Before publishing, test everything. Use GTM Preview mode and walk through a complete purchase flow on your site:
- View a product page
- Add to cart
- Proceed to checkout
- Complete purchase
Check the “Tags Fired” section in the debug panel. Ensure each event (view_item, add_to_cart, begin_checkout, purchase) fires the corresponding tags.
Also, verify data in GA4 Real-Time reports. Go to GA4 > Reports > Realtime. You should see the purchase event with revenue data within seconds.
Common issues Indian merchants face:
- Currency mismatch: Ensure all values are in INR, not USD.
- Duplicate transactions: Use the transaction_id to deduplicate in GA4.
- DataLayer not firing: Check browser console for errors.
Step 6: Publish and Monitor Performance
Once testing is successful, click “Submit” in GTM and add a version description (e.g., “v1.0 – Initial e-commerce tracking setup”).
After publishing, monitor for 48-72 hours. Use GA4’s “Monetization” reports to see revenue, purchases, and item performance. Compare with your actual sales data to ensure accuracy.
For advanced tracking, consider:
- Scroll depth tracking – Understand how far users scroll on product pages.
- Form abandonment tracking – Capture users who start checkout but don’t finish.
- Cross-domain tracking – If you use a separate payment gateway like Razorpay or Paytm.
Advanced Tips for Indian E-Commerce Stores
Here are some India-specific optimizations that can dramatically improve your tracking:
1. Handle COD Orders
Cash on Delivery (COD) is still 40-60% of e-commerce transactions in India. Ensure your DataLayer captures COD orders with a separate flag (e.g., payment_method: 'COD'). This helps you segment COD vs. prepaid performance in GA4.
2. Track UPI and Wallet Payments
With UPI (BHIM, Google Pay, PhonePe) dominating Indian payments, make sure your purchase event captures the payment gateway. Use custom dimensions in GA4 to analyze which payment methods convert best.
3. Localize Your Tracking
Use Indian currency (INR) consistently. Set your GA4 property timezone to “Asia/Kolkata” to align with your business hours.
4. Use GTM for A/B Testing
Integrate Google Optimize with GTM to run A/B tests on product pages, pricing, and CTAs. Indian consumers respond differently to discounts vs. free shipping—test to find what works.
5. Leverage AK Network Solutions Expertise
At AK Network Solutions, we’ve helped over 50 Indian e-commerce brands set up robust GTM tracking that increased their ROAS by 35% on