Build structured dataLayer.push() payloads for Google Tag Manager. Pick an event, fill in the fields, and copy code that fires your tags correctly.
<!-- Paste this in your <head> -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
// Select an event type and click Generate
dataLayer.push() - Push an object to the data layer array.
event - The event name that triggers GTM rules.
ecommerce - Wrapped object for GA4 e-commerce events.
Tip Use gtm.init or gtm.dom for early pageview triggers.
Google Tag Manager is the standard way to manage tracking and analytics tags without editing site code. The data layer is what makes that possible. It acts as a structured repository that passes information from your site to your tags, so when an event happens, every tool that needs that data can read it in the same shape. Correctly formatted data layer events mean your analytics, conversion tracking, and marketing pixels fire accurately.
Every interaction on your site can become a trackable event. Pageviews, clicks, form submissions, and purchases all carry context that the data layer captures at the moment they happen. When events are structured well, you can build detailed reports, create remarketing audiences, and optimize conversion funnels based on real user behaviour rather than guesses.
Online stores depend on this layer for Google Analytics 4 enhanced measurement. Purchase, add to cart, and view item events with accurate parameters power product performance reports, revenue attribution, and shopping behaviour analysis. Getting the data layer right from the start saves hours of debugging later.
Select the event type that matches the interaction you want to track. Each type presents a focused form with the fields most relevant to that event. Fill in the page path for a pageview, the click text for a click event, or the transaction data for an ecommerce purchase.
Use the Extra Parameters field to add custom key value pairs beyond the standard fields. Enter one parameter per line in the format key: value. These merge into the data layer object alongside the event specific fields, giving you full flexibility to pass anything your GTM configuration needs.
Click Generate Code to produce the formatted dataLayer.push() statement. Copy the output and place it on your site before the GTM container snippet, or use it inside a custom HTML tag within GTM itself. The Tracking Snippet section provides the standard container code for reference when you set up a new site.