Google Analytics events
Which events the AI Sales Agent and AI Search send to your Google Analytics 4, and what each one means.
Updated:
If your website uses Google Analytics 4 (GA4), the AI Sales Agent and AI Search send events to it automatically. They are sent only for visitors who agreed to analytics cookies (see Cookie consent). If GA4 runs through the Google tag (gtag.js), there is nothing else to set up. If you only use Google Tag Manager, see Google Tag Manager below. Every event name starts with yasan_, so you can find them easily.
If your website has no Google Analytics, nothing is sent and both widgets work as usual.
Google Tag Manager#
If your website has Google Tag Manager but no Google tag (gtag.js), the widgets put the events into the Tag Manager data layer (dataLayer). Tag Manager passes them on to GA4 only once you tell it to:
- Create a Custom Event trigger, set Event name to
^yasan_and tick Use regex matching. - Create a Google Analytics: GA4 Event tag with your measurement ID, set Event name to
{{Event}}and fire it on that trigger. - For each parameter you want in GA4 (for example
product_idorposition), create a Data Layer Variable of the same name and add it to the tag’s event parameters. - Publish the container.
Cookie consent#
Consent is checked twice:
- The widgets send events only for visitors who agreed to analytics cookies. The widget has to know the visitor’s choice: on Shoptet it reads it from the Shoptet cookie bar automatically; on other platforms, pass it to the widget with
window.Whisper.setConsent, as described in Setting up cookie consent. Until the widget knows that the visitor agreed, nothing is sent to Google Analytics. - Google Analytics then applies its own Consent Mode, just as for the rest of your website: in advanced Consent Mode, it only records anonymous, cookieless pings without consent; in basic Consent Mode, nothing is sent to Google until the visitor agrees.
What we send, and what we don’t#
We never send the text of messages, search queries, e-mail addresses or any other personal details. The events only say what happened, plus details such as the product ID and name, the product’s position in the list, or the number of products shown.
Every event carries the yasan_widget parameter: chatbot for the AI Sales Agent, search for AI Search.
AI Sales Agent events#
| Event | When it is sent | Parameters |
|---|---|---|
yasan_chatbot_loaded |
The chat widget loaded on the page | – |
yasan_chatbot_open |
The chat window opened | open_trigger: manual (the visitor), auto (opens by itself), operator (an operator joined), restored (it was already open) |
yasan_chatbot_close |
The chat window closed | – |
yasan_chatbot_invitation_shown |
The chat invitation appeared | – |
yasan_chatbot_invitation_dismissed |
The visitor closed the invitation | – |
yasan_chatbot_message_sent |
The visitor sent a message | is_first_message |
yasan_chatbot_reply_received |
A reply arrived | reply_type (assistant or operator), product_count, has_questions, handoff_offered, latency_ms |
yasan_chatbot_product_view |
A recommended product appeared in the chat | product_id, product_name |
yasan_chatbot_product_click |
The visitor clicked a recommended product | product_id, product_name, position |
yasan_chatbot_add_to_cart |
A product was added to the cart from the chat | product_id |
yasan_chatbot_discount_copied |
The visitor copied a discount code | product_id |
yasan_chatbot_questions_answered |
The visitor answered the follow-up questions | question_count |
yasan_chatbot_questions_skipped |
The visitor skipped the follow-up questions | – |
yasan_chatbot_contact_form_open |
The form for contacting a person opened | source (header or message) |
yasan_chatbot_contact_submitted |
The visitor left their contact details | live_chat_enabled |
yasan_chatbot_email_verified |
The visitor confirmed their e-mail with a code | – |
yasan_chatbot_operator_joined |
An operator took over the conversation | – |
yasan_chatbot_conversation_reset |
The visitor started a new conversation | – |
AI Search events#
| Event | When it is sent | Parameters |
|---|---|---|
yasan_search_open |
The search window opened | open_source: focus, click, submit, input or key (how the visitor opened it) |
yasan_search_close |
The search window closed | – |
yasan_search_focus_shelf_shown |
The product tips shown before typing appeared | – |
yasan_search_submitted |
A search was made | trigger: submit (Enter), pause (the visitor stopped typing), handover (from your own search box), scope (a filter changed), retry |
yasan_search_no_results |
Nothing matched the search | – |
yasan_search_answer_received |
The AI answer to a search arrived | product_count, has_questions |
yasan_search_product_click |
The visitor clicked a product | product_id, surface, position, category_id |
yasan_search_add_to_cart |
A product was added to the cart from the search | product_id, surface, position |
yasan_search_shelf_open |
The visitor opened a whole product row | surface, category_id, position |
yasan_search_load_more |
The visitor loaded more products | – |
yasan_search_filter_add |
The visitor added a filter | filter_type, filter_key, surface |
yasan_search_filter_remove |
The visitor removed a filter | filter_type, filter_key, surface |
yasan_search_question_answered |
The visitor answered a follow-up question | surface, position |
yasan_search_message_sent |
The visitor sent a message in the chat view | – |
yasan_search_reply_received |
A reply arrived in the chat view | product_count, has_questions, latency_ms |
surface says where on the screen the product or row was, for example primary (main results), recommended, category or chat.
Tips for Google Analytics#
- Find the events in Reports → Engagement → Events. New events can take up to 48 hours to appear in reports; you can see them right away in Realtime.
- To count add-to-cart from the AI Sales Agent and AI Search as conversions, mark
yasan_chatbot_add_to_cartandyasan_search_add_to_cartas key events in Admin → Data display → Events. - To see parameters such as
positionorsurfacein reports, register them as custom dimensions in Admin → Data display → Custom definitions.