Free DataLayer Generator
Generate properly formatted dataLayer.push() code for Google Tag Manager. Build e-commerce tracking, page views, user data, and custom events with our free dataLayer builder.
Transaction Data
List Data
Products (Items Array)
Page Information
User Properties
Push user data to the dataLayer for enhanced tracking and personalization.
Privacy-Safe User Data
For enhanced conversions. Hash before sending to the dataLayer in production.
Form Details
Use snake_case for GA4 compatibility (e.g., video_play, button_click)
Custom Parameters
Generated DataLayer Code
GTM Setup Tip
Want Automatic DataLayer Setup?
PixelFly automatically pushes properly formatted e-commerce events to your dataLayer. No coding required.
Start Free TrialHow the DataLayer Works
The dataLayer is the foundation of Google Tag Manager. Here's how to use it effectively.
Initialize DataLayer
Add this before your GTM container snippet:
window.dataLayer = window.dataLayer || [];
Push Events
Use dataLayer.push() to send data:
dataLayer.push({
event: 'purchase',
ecommerce: { ... }
});
Configure GTM
Set up triggers and tags in GTM:
- - Create Custom Event triggers
- - Use Data Layer Variables
- - Connect to GA4 tags
GA4 E-commerce Events Reference
Complete list of GA4 e-commerce events and when to use them in your customer journey
| Event | When to Fire | Required Parameters |
|---|---|---|
| view_item_list | Category page, search results | items[], item_list_id, item_list_name |
| select_item | Product click from list | items[], item_list_id, item_list_name |
| view_item | Product detail page | items[], currency, value |
| add_to_cart | Add to cart button click | items[], currency, value |
| view_cart | Cart page view | items[], currency, value |
| begin_checkout | Checkout initiation | items[], currency, value |
| add_shipping_info | Shipping method selected | items[], currency, value, shipping_tier |
| add_payment_info | Payment info entered | items[], currency, value, payment_type |
| purchase | Order confirmation | items[], transaction_id, currency, value |
| refund | Order refund processed | transaction_id, currency, value |
DataLayer FAQ
Common questions about dataLayer implementation
dataLayer.push({ ecommerce: null }) before each e-commerce event push. Our generator includes this automatically.
Skip the Manual DataLayer Setup
PixelFly automatically handles dataLayer implementation for your e-commerce store. Works with Shopify, WooCommerce, and custom sites.
No credit card required. 14-day free trial.