Track Guide Events in Your Data Layer

Roccai pushes a roccai_-prefixed event to your site's data layer after every Guide interaction — session start, each card answered, the recommendations shown, and form submits with hashed contact details. GTM, GA4 and chatbots read them in real time. Watch the events fire in the live demo below, then follow the GTM steps to forward them.

Updated

Roccai pushes a structured, roccai_-prefixed event to your website's data layer after every Guide interaction — GTM, GA4, chatbots and personalisation scripts can read each one the moment it fires.

Every interaction in a Guide generates declared preference data — the user tells you directly what they want, rather than you inferring it from browsing behaviour. This article shows exactly which events your Guide sends, lets you watch them fire in a live demo, and walks through forwarding them to your marketing stack.

What your Guide captures

  • What they were asked — each card's question text, sent as card_question alongside the answer.
  • What they want — the options they selected or responded positively to, in decision_item_inputs.
  • What they don't want — attributes they rejected or swiped no on, as negative scores in the running profile.
  • What they were shown — the recommended products, including product IDs and links.
  • What they shared — form field values (SHA-256 hashed) and consent status from any submitted form.

How events reach your page

The Guide runs inside an iframe. After every interaction it pushes the event to window.dataLayer and posts the same payload to the parent page via window.postMessage, wrapped in an envelope: { type: 'roccai_datalayer_event', data: <the payload>, timestamp }. Google Tag Manager picks up the data-layer push directly; custom listeners should validate event.origin against the module host serving your guide (for most guides https://module.roccai.com) before using the payload.

All event names are prefixed roccai_. Where a GA4 standard event applies, the standard name is used and the Roccai-specific name rides along as custom_event_name.

Try it — watch the events fire live

Answer a few cards in the demo guide below. The console beside it prints every event the guide posts, exactly as GTM receives it — click any row to inspect the full payload. After each answer, roccai_user_interaction arrives carrying the question (card_question), your answer (decision_item_inputs) and your running preference profile (accumulated_tag_scores). Finish the journey to see roccai_finished_swiping fire, followed by the recommended products.

window.dataLayer0 events

Waiting for events — answer a card in the guide and each roccai_* event appears here the moment it fires. Click an event to see the full payload.

Events reference

EventFires whenKey fields
roccai_create_sessionOnce, when the journey initialises (iframe load)company_id, module_id, campaign_id, session_id
roccai_user_interactionAfter every card answer — swipe or skipcard_question, decision_item_inputs, accumulated_tag_scores
roccai_set_user_propertiesAfter each card answer, and again when results loaduser_properties: roccai_preference_N, roccai_top_dislike_N, roccai_rec_1/2/3_id
roccai_finished_swipingThe last card is answered, before resultsSession IDs only — use as a conversion trigger
roccai_recommended_products_loadedThe results card rendersrecommended_products (externalId + link)
roccai_select_itemA recommended product is clickedproduct_external_id
roccai_form_submitAn input card with form fields is submittedform_field_values (SHA-256 hashed), consent_items
roccai_share, roccai_open_external_page, roccai_load_more_items, roccai_reload_guide, roccai_save_guide_resultsSharing, external links, “load more”, restarts, saved resultscustom_event_name distinguishes the action

In accumulated_tag_scores, a chosen option adds +1 per tag, a swiped no or rejected preference-card option subtracts 1, and skips change nothing. The list is the running total across the whole session — positive scores are preferences, negative scores are aversions.

Privacy: what never reaches your data layer

Contact details entered in a form (email, name, phone) are stored securely in your Roccai account but never reach the data layer in readable form. Before any field value leaves the Guide it is converted to a one-way SHA-256 fingerprint — the original cannot be reconstructed, yet the hash is deterministic, so a CRM that stores hashed emails can still match the same user across systems. Consent statements are sent in plain text, including whether they were accepted or declined. Your GTM and GA4 setup stays GDPR-compliant by design.

Forward the data with Google Tag Manager

Routing the events into GA4, Google Ads or your CRM is a one-time GTM setup — the steps below walk through it. Once configured, everything flows automatically: user properties for audience building, conversions on journey completion, and product-level retargeting data.

  1. Create data layer variables

    In GTM, create a Data Layer Variable for each field you want in tags or triggers — company_id, session_id, custom_event_name, card_question, decision_item_inputs, accumulated_tag_scores, recommended_products, and the user_properties.roccai_* keys (roccai_preference_1…N, roccai_top_dislike_1…N, roccai_rec_1/2/3_id).

  2. Forward user properties to GA4

    Add a Custom Event trigger on roccai_set_user_properties and a GA4 event tag on it. Under User Properties, map each variable to its property name (e.g. key roccai_preference_1, value {{DLV - roccai_preference_1}}).

  3. Track journey completion as a conversion

    Add a Custom Event trigger on roccai_finished_swiping and a GA4 event tag with a name like generate_lead, then mark that event as a conversion in GA4.

  4. Track input card submissions

    Add a Custom Event trigger on roccai_form_submit. Optionally include form_field_values as a custom parameter — the hashed values support enhanced conversion matching if your CRM stores hashed emails.

  5. Track product interactions

    Trigger on roccai_recommended_products_loaded to record which products were shown (pass recommended_products as a parameter), and on roccai_select_item for click-throughs (product_external_id).

  6. Build retargeting audiences in GA4

    Once user properties are flowing, create GA4 audiences with conditions like “roccai_preference_1 contains sustainability” or “roccai_rec_1_id equals a specific SKU”. These sync to Google Ads for RLSA and Display campaigns.

Latest help guides