Without a data layer, it is not easy to 'pass the payment amount from the purchase completion page to GA4'. Developers must manually modify GA4 code each time. When using a data layer, the developer simply calls dataLayer.push() in a designated format when a page event occurs, and GTM receives the data and delivers it to GA4 and Google Ads.
The structure is to push an object into the window.dataLayer array. Example: dataLayer.push({'event':'purchase','value':150000,'item_name':'operation name'}). GTM's data layer variable reads this value and uses it as a tag parameter.
weballin designs a standard data layer for phone clicks (tel: anchor), reservation form submission, and KakaoTalk channel clicks on the hospital site. In particular, in the SPA (React/Next.js) environment, history API integration design is required to prevent the data layer from being initialized when navigating between pages.
Key takeaways
- Structure page event data into a standard format that GTM and GA4 can read.
- Separate developer and marketer roles: developers push data to the data layer, marketers set GTM tags.
- E-commerce events (view_item·add_to_cart·purchase) are delivered to the standard GA4 schema.
- In SPA (React/Next.js/Vue), manually trigger page movement events to the data layer.
- The value pushed to the GTM data layer variable is automatically connected to the tag parameter.
