SublimDocs

Google dataLayer (GA4 / GTM)

Many sites already push GA4 events to window.dataLayer, through Google Tag Manager, Shopify, WooCommerce or PrestaShop. Sublim can reuse them directly: no extra tag, no code.

Turning it on

In the dashboard, open Custom Events → Data layer, turn it on, and choose which events to forward. It can also be forced from the snippet:

JavaScript
sublim.o = { projectId: 'YOUR_PROJECT_ID', dataLayer: true };

If your tag manager uses another variable name, set dataLayerName: 'myDataLayer'.

Forwarded events

These GA4 events are forwarded under the same name:

purchase add_to_cart remove_from_cart begin_checkout view_cart view_item view_item_list select_item search sign_up login generate_lead

Events already pushed before the tracker loaded are picked up too. GTM's internal events (gtm.*), page_view, session_start, first_visit, user_engagement and scroll are never forwarded: the tracker measures those itself.

PropertyFrom
items_count, first_item_id, first_item_name, item_categoryecommerce.items
currency, valueecommerce.currency, ecommerce.value
search_termsearch
methodsign_up, login
item_list_nameview_item_list

A purchase is sent with its value and currency as revenue. Its transaction_id is used only to avoid counting an order twice, and is never sent.

Personal data

Keys that may hold personal data are removed before sending, at any depth: email, phone, first_name, last_name, address, city, zip, user_id, customer_id, ip, gclid, fbclid, user_data… Long values are truncated to 256 characters.

When Respect consent is on, which is the default, forwarded dataLayer events are held, not dropped, until Google Consent Mode grants analytics_storage:

JavaScript
gtag('consent', 'update', { analytics_storage: 'granted' });

Held events are then sent. If consent is later denied again, forwarding pauses.

This only concerns dataLayer events. The tracker's own measurement is cookieless and doesn't depend on consent. See Privacy & data.

With automatic detection

  • When the dataLayer provides add_to_cart, the tracker's own add-to-cart button detection is switched off, so nothing is counted twice.
  • A purchase is forwarded only if none was already sent on the page by trackPurchase or thank-you page detection.