Track Guide Events in Your Data Layer

In short

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

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, its standard name is used — still with the prefix, e.g. roccai_form_submit, never bare form_submit — and the Roccai-specific action rides along as custom_event_name on those events.

Build your GTM triggers on event, not on custom_event_name. The event names are stable; custom_event_name values can change as we add detail to the tracking. If you need to tell actions apart, read custom_event_name as a variable inside the tag instead of filtering the trigger on it.

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_id, card_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 (rec IDs only when the product's external ID fits GA4's 36-character limit)
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_itemAny button on a recommended product is pressed (except one that only opens the product's details)product_id, product_external_id, action_types, button_text — custom_event_name: product_button_clicked
roccai_view_itemA visitor opens a product's detailsproduct_id, product_external_id — custom_event_name: result_see_details_clicked
roccai_form_submitAn input card with form fields is submittedform_field_values (SHA-256 hashed), consent_items
roccai_open_external_pageA card button opens a link, or the visitor opens your website from the resultsCard button: custom_event_name card_open_page, with card_id, card_type, button_text. From the results: custom_event_name results_view_visit_website
roccai_shareA card button shares a link, or the visitor shares the guideCard button: custom_event_name card_share_link_success, with card_id, card_type, button_text (plus product_id when the button is on a product). Guide share: custom_event_name share_module_success
roccai_load_more_itemsThe visitor loads more resultscustom_event_name: result_load_more
roccai_reload_guide, roccai_save_guide_resultsGuide restarts, saved resultsSession IDs only — these do not carry custom_event_name; the event name itself is 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. Tags marked as excluded are never scored. The list is the running total across the whole session — positive scores are preferences, negative scores are aversions.

Button events

Every button press on a recommended product sends roccai_select_item — not only “open product link”, but also buttons that go to the next card, share, save or open a page. Two fields tell you which button it was:

  • action_types — what the button does, as comma-separated text in the order the actions are set up, e.g. openProductLink or share,nextCard. Possible values: openProductLink, nextCard, share, openPage, save, seeDetails.
  • button_text — the label the visitor saw on the button.

A product button that only opens the product's details sends roccai_view_item instead, as does expanding a product to read more. A product button that shares also sends roccai_share once the share completes. Buttons on other cards send roccai_open_external_page or roccai_share with card_type and button_text, so you can see which card and which button the visitor used. Only successful shares are sent — a cancelled or failed share does not reach the data layer.

These events were extended in November 2026. The event names did not change, but the custom_event_name values did: result_clicked is now product_button_clicked, input_card_open_page is now card_open_page, and input_card_share_link_success is now card_share_link_success. Triggers built on event keep working; triggers or reports that filter on the old custom_event_name values need updating.

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, product_external_id, action_types, button_text, card_type, 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), on roccai_select_item for product button presses (product_external_id, action_types, button_text), and on roccai_view_item for product detail views (product_external_id). Trigger on the event name, not on custom_event_name.

  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