Vigyata.AI
Is this your channel?

The ABSOLUTE BEST Way to Create a Product Array in GTM with Custom JavaScript

147 views· 3 likes· 5:08· Jul 14, 2025

🛍️ Products Mentioned (4)

No Developer? No Problem! In this tutorial, I'll demonstrate precisely how to push a single product array with Custom JavaScript in Google Tag Manager (GTM) — without coding complicated stuff or paying a developer. This product range is required for establishing conversion tracking with systems such as: - Facebook Conversion API (CAPI) - Google Analytics 4 (GA4) - TikTok Pixel - Google Ads Dynamic Remarketing ✨ MD FAISAL AMIN — Tracking & Analytics Specialist GA4 • GTM • Meta CAPI • Server-Side Tracking Expert 👨‍💼 Work With Me 🔗 https://linktr.ee/mdfaisalaminbd 📅 Book a Free Website Tracking Audit 🔗 https://zcal.co/faialamindm/30min 🤩 Client Testimonials (Real Results) 🔗 https://youtu.be/0-6M7UT9z4M?si=207yqL8w5Z8jzv0M 💬 WhatsApp — Instant Chat 🔗 https://api.whatsapp.com/send?phone=8801726269000 📨 Telegram — Fast Response 🔗 https://t.me/webanalyticsfaisalamin 🔗 Connect With Me 🌐 Website: 🔗 https://mdfaisalamin.com 📧 Email: 🔗 faisalaminseomarketer@gmail.com ▶️ YouTube: 🔗 https://youtube.com/@mdfaisalamin 💼 LinkedIn: 🔗 https://linkedin.com/in/mdfaisalamindm 📘 Facebook: 🔗 https://facebook.com/mdfaisalamindm 🐦 Twitter (X): 🔗 https://twitter.com/mdfaisalamindm ☎️ Phone: 🔗 +88 01726269000 What You'll Learn in This Video: ✅ How to build a custom JavaScript function in GTM ✅ Organize the product array schema properly (item_name, item_id, price, quantity) ✅ Insert GTM variables into the array dynamically ✅ Preview & test the array in GTM debug mode ✅ Utilize the array in tag templates for GA4, Meta, TikTok, and others This is 100% no-code friendly and ideal for marketers, store owners, or analytics professionals who want to simplify tracking setups. Regardless of whether you are configuring enhanced eCommerce tracking or preparing your data for server-side events, this guide provides the precise way to capture product data in the needed format. Don't forget to: Like this video Comment with your questions Subscribe for weekly tutorials Having trouble with tracking setup? Dynamic Total Value Tracking with Custom JavaScript (DOM Scraping) - GTM - https://youtu.be/0zBlCWeKVDk?si=jh4XxORzgOfm_9gu Dom Scraping: Extract Price From the Page with GTM - https://youtu.be/BV0Pu3h_g6M?si=Z7olYsE2pBUPG1Wx Single product Array function(){ return [ { "item_name" : {{cjs product name}}, "item_id" : {{cjs content id}}, "price" : {{cjs product price}}, "quantity" : 1 } ]; }

About This Video

In this video I show you the absolute best way to create a single item product array in Google Tag Manager using a Custom JavaScript variable—without any developer help. I’m doing this for a real client website where I already scraped the product data like product name, price, currency, and item ID. If you don’t know the scraping method yet, I mentioned that I’m sharing the related link in the description so you can collect those values first. Then inside GTM, I create a new Custom JavaScript variable and build the array using the GA4 items schema. I add item_name (from my scraped product name variable), item_id (from my content ID variable), price (from my scraped product price), and quantity (I set it as 1 because it’s a single product page and there’s no quantity selector). After saving, I test everything in GTM Preview/Tag Assistant and confirm the variable is returning the correct array format. Once you have this array, you can reuse it for tracking setups like GA4 ecommerce, Meta CAPI, TikTok Pixel, and dynamic remarketing—clean and simple.

Frequently Asked Questions

🎬 More from Md Faisal Amin