Data layer

A data layer for Google Tag Manager

Google Tag Manager is only as good as the data layer under it. With one store setting, the ROASaurus script pushes the storefront events it already tracks into window.dataLayer in GA4's ecommerce format, so your own tags can use them without custom theme code.

14-day trial of every feature, no credit card. Free plan for up to 100 orders a month after it.

Diagram

  1. Visitor actionA page or product view, a search, an add to cart or a checkout start.
  2. ROASaurus scriptAlready on your store for server-side tracking.
  3. window.dataLayerThe event in GA4's ecommerce format, with its items and the event id.
  4. Your GTM tagsGA4, ads pixels or your own, triggered by the event name.
How the data layer is filled (diagram).

What is pushed

Events and their details

  • Page view

    page_view with the page type, market, country, currency and language.

  • Products and lists

    view_item, view_item_list and search, with item id, product id, name, SKU and price, and on lists the list name and position.

  • Cart and checkout

    add_to_cart, remove_from_cart, view_cart and add_to_wishlist, with the items, value and currency. begin_checkout and purchase only where the checkout and thank-you page run the ROASaurus storefront script; on Shopify they stay with the custom pixel.

  • Purchases, leads and 404s

    purchase with items, tax and shipping where the thank-you page runs the ROASaurus script; generate_lead for site forms; page_not_found for missing pages.

Good to know. Each push first clears the previous ecommerce object, as Google asks, and carries the event id ROASaurus sent to the server, for deduplication in your tags.No email, customer id or other identifier is pushed.On Shopify the checkout and thank-you page run outside the theme, so purchases are not pushed there; the server-side purchase still reaches your destinations.Product clicks in lists (select_item) and variant changes are not detected.

How to switch it on

One setting, then your tags

  1. Switch it on

    In the app, open Settings › Store and tick Push storefront events to the data layer for Google Tag Manager. It is off by default and needs no theme code.

  2. Import the container, or build your own

    The option links a ready GTM container to import: a Google tag for your GA4 measurement id and one GA4 event tag for these events, with event_id as a parameter. Or use the events in your own triggers and variables.

  3. Consent is followed

    Events are pushed only for visitors the store's consent mode allows to be tracked, like every other ROASaurus event.

Read next

Related pages

FAQ

Questions, answered

More answers in the FAQ and the help center.

What is in the data layer?

Storefront events in GA4's ecommerce format: page_view, view_item, view_item_list, search, add_to_cart, remove_from_cart, view_cart, add_to_wishlist, generate_lead and page_not_found. begin_checkout and purchase only where the store's checkout and thank-you page run the ROASaurus storefront script; on Shopify they stay with the custom pixel.

Does it need code?

No: it is a store setting, off by default. The script that already runs for server-side tracking does the pushing.

Does it push customer data?

No. Events carry items, values and page details; no email, customer id or other identifier is pushed.

Can I customise it?

Use any event and parameter in your own GTM tags. The push itself follows GA4's ecommerce format, so tags built for GA4 ecommerce can read it.

Does it slow the store down?

It adds no extra script: the pushes come from the ROASaurus script that is already on the page.

Every sale, traced to the ad that earned it

Server-side tracking, profit and lifetime value in one app. Free plan, no credit card.