/
<NEW> Google Analytics events Data Layer

<NEW> Google Analytics events Data Layer

This article explains how you can track AI shopping assistant user behaviour within your own Google Analytics (GA) reports.

4 easy steps

  1. Contact your Customer Success representative to turn on your ‘data layer’ AI shopping assistant events

  2. Create custom variables to pass data layer values into your Google Tag Manager (GTM)

  3. Create custom tags in your GTM to pass the data to your GA

  4. Create the custom variables in your GA4 to use them in your reports

This guide covers passing all of the available AI shopping assistant events into your GA, however you can choose to pass only the ones you need

Step 1: Check the data layer is turned on

After your CS rep has confirmed this is now activated, open up Google Chrome browser:

  • Visit your website page where AI shopping assistant is loaded, e.g.

 

  • Interact with widget

  • When you have done some interaction, right-click > Inspect (or Ctrl+Shift+I) to open the Chrome Developer tools console

 

  • Choose the Console tab, type dataLayer (it’s case sensitive!) and hit Enter, you will now see the fired events:

 

  • Depending on what action you performed you will see AI shopping assistant events fired (full details) for:

    • aishoppingassistant.view - fired everytime AI shopping assistant widget is loaded

    • aishoppingassistant.externalTrigger - fired everytime external trigger activates

    • aishoppingassistant.opened - fired everytime someone opened chat window

    • aishoppingassistant.1stMessageSent - fired everytime someone sent a first message

    • aishoppingassistant.messageSent - fired everytime someone sent a message

    • aishoppingassistant.productRecommended - fired everytime products are recommended

    • aishoppingassistant.productClick - fired everytime someone clicks on a product

    • aishoppingassistant.addToCart - fired if someone adds a product to the cart from the widget

    • aishoppingassistant.restart - fired when someone restart the chat

    • aishoppingassistant.closed - fired when someone closed the widget

  • PDP Events

    • aishoppingassistant.pdp.view - fired everytime AI shopping assistant widget is loaded

    • aishoppingassistant.pdp.externalTrigger - fired everytime external trigger activates

    • aishoppingassistant.pdp.1stMessageSent - fired everytime someone sent a first message

    • aishoppingassistant.pdp.messageSent - fired everytime someone sent a message

    • aishoppingassistant.pdp.productRecommended - fired everytime products are recommended

    • aishoppingassistant.pdp.productClick - fired everytime someone clicks on a product

    • aishoppingassistant.pdp.addToCart - fired if someone adds a product to the cart from the widget

    • aishoppingassistant.pdp.restart - fired when someone restart the chat

You’re now ready to join this custom data to your GA using GTM.


Step 2: Pass AI shopping assistant data into Google Tag Manager (GTM)

2a. Create the GTM Data Layer Variables

This will allow any GTM tags to use the preezie data variables (as GA4 parameters) in various ways.

First go to your GTM account:

  1. Variables > User-Defined Variables > New

  2. Give it a name of aishoppingassistant.products

  3. Click Variable Configuration > Data Layer Variable

image-20250401-011546.png
  1. In Data Layer Variable Name enter aishoppingassistant.products hit Save

image-20250401-011640.png
  • Repeat these 4 steps to create the other 8 data layer variables needed:

Variable name (8 Data Layer Variables)

Data Layer Variable Name

What it captures

Variable name (8 Data Layer Variables)

Data Layer Variable Name

What it captures

aishoppingassistant.visitorId

aishoppingassistant.visitorId

The user using the AI shopping assistant widget

aishoppingassistant.sessionId

aishoppingassistant.sessionId

The user using the AI shopping assistant widget

aishoppingassistant.page

aishoppingassistant.page

The page that user is on

aishoppingassistant.message

aishoppingassistant.message

The message user sent in the AI shopping assistant

aishoppingassistant.isSuggestedText

aishoppingassistant.isSuggestedText

The message is coming from suggested text

aishoppingassistant.products(array)

aishoppingassistant.products

The products recommended

aishoppingassistant.productId

aishoppingassistant.productId

The unique id of the clicked product in the recommended products (as defined by your product feed)

aishoppingassistant.productName

aishoppingassistant.productName

The name of the product that was clicked on.

aishoppingassistant.productPrice

aishoppingassistant.productPrice

The price of the product that was clicked on

aishoppingassistant.productPosition

aishoppingassistant.productPosition

The position the clicked product was ranked in the recommendation products

aishoppingassistant.triggerType

aishoppingassistant.triggerType

The trigger type of the external trigger

  • Now to join the above to Data Layer events, repeat the above steps 9 times but instead use variable type Custom Event - just ensure the variable names match these below:

Variable name (Custom Event)

What it captures

Variable name (Custom Event)

What it captures

aishoppingassistant.view

When the AI shopping assistant loads

aishoppingassistant.externalTrigger

When the external trigger fires

aishoppingassistant.opened

When the chat model opened

aishoppingassistant.1stMessageSent

When the 1st message sent

aishoppingassistant.messageSent

When the message sent

aishoppingassistant.productRecommended

Products recommended

aishoppingassistant.productClick

A click on a product recommendation

aishoppingassistant.addToCart

When add-to-cart is performed

aishoppingassistant.restart

When chat is restarted

aishoppingassistant.closed

When widget is closed

You now have your new variables, they should look like this:

image-20250401-021705.png
  • PDP Custom Events

Variable name (Custom Event)

What it captures

Variable name (Custom Event)

What it captures

aishoppingassistant.pdp.view

When the AI shopping assistant loads

aishoppingassistant.pdp.externalTrigger

When the external trigger fires

aishoppingassistant.pdp.1stMessageSent

When the 1st message sent

aishoppingassistant.pdp.messageSent

When the message sent

aishoppingassistant.pdp.productRecommended

Products recommended

aishoppingassistant.pdp.productClick

A click on a product recommendation

aishoppingassistant.pdp.addToCart

When add-to-cart is performed

aishoppingassistant.pdp.restart

When chat is restarted

2b. Create the GTM triggers for your tags

In your GTM account, create these triggers before you create your tags:

AI shopping assistant ‘view’ event

  • Triggers > New

  • Name: aishoppingassistant.view

  • Trigger Type: Custom Event

  • Event name: aishoppingassistant.view

  • Save

Now repeat these steps for the other 8 triggers:

Name (9 triggers)

Trigger Type

Event name

What it captures

Name (9 triggers)

Trigger Type

Event name

What it captures

aishoppingassistant.view

Custom Event

aishoppingassistant.view

Each time the AI shopping assistant widget loads on the page

aishoppingassistant.externalTrigger

Custom Event

aishoppingassistant.externalTrigger

Each time the external trigger fires

aishoppingassistant.opened

Custom Event

aishoppingassistant.opened

Each time the user opens the AI shopping assistant widget

aishoppingassistant.1stMessageSent

Custom Event

aishoppingassistant.1stMessageSent

When the user sent the first message

aishoppingassistant.messageSent

Custom Event

aishoppingassistant.messageSent

When a message is sent from user

aishoppingassistant.productRecommended

Custom Event

aishoppingassistant.productRecommended

When products are recommended

aishoppingassistant.productClick

Custom Event

aishoppingassistant.productClick

Each click to product in the recommended products

aishoppingassistant.addToCart

Custom Event

aishoppingassistant.addToCart

When product is add to the cart

aishoppingassistant.restart

Custom Event

aishoppingassistant.restart

When user restart the chat

aishoppingassistant.closed

Custom Event

aishoppingassistant.closed

When the AI shopping assistant widget is closed

image-20250401-023023.png

PDP Tags

Name (9 triggers)

Trigger Type

Event name

What it captures

Name (9 triggers)

Trigger Type

Event name

What it captures

aishoppingassistant.pdp.view

Custom Event

aishoppingassistant.pdp.view

Each time the AI shopping assistant widget loads on the page

aishoppingassistant.pdp.externalTrigger

Custom Event

aishoppingassistant.pdp.externalTrigger

Each time the external trigger fires

aishoppingassistant.pdp.1stMessageSent

Custom Event

aishoppingassistant.pdp.1stMessageSent

When the user sent the first message

aishoppingassistant.pdp.messageSent

Custom Event

aishoppingassistant.pdp.messageSent

When a message is sent from user

aishoppingassistant.pdp.productRecommended

Custom Event

aishoppingassistant.pdp.productRecommended

When products are recommended

aishoppingassistant.pdp.productClick

Custom Event

aishoppingassistant.pdp.productClick

Each click to product in the recommended products

aishoppingassistant.pdp.addToCart

Custom Event

aishoppingassistant.pdp.addToCart

When product is add to the cart

aishoppingassistant.pdp.restart

Custom Event

aishoppingassistant.pdp.restart

When user restart the chat

Step 3: Create GA4 tags

Now you need to create tags to tell GA what event data is available. Each event fired contains parameters, you can choose which parameters you’d like to send to GA4 (full details).

3a. Tag set up

  • In GTM > Tags > New

  • Create and publish these tags with the below values:

If you want to include other parameters just use the same format with the variables from Step 2a.

Tag name

Taq type

Configuration Tag

Event Name

Event Parameter Name

Value

Trigger (as per Step 2b)

Tag name

Taq type

Configuration Tag

Event Name

Event Parameter Name

Value

Trigger (as per Step 2b)

GA4 aishoppingassistant_view

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_view

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.view
Custom Event

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_externalTrigger

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_externalTrigger

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.externalTrigger
Custom Event

 

 

 

 

aishoppingassistant_message

{{aishoppingassistant.message}}

 

 

 

 

aishoppingassistant_trigger_type

{{aishoppingassistant.triggerType}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_opened

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_opened

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.opened
Custom Event

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_1stMessageSent

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_1stMessageSent

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.1stMessageSent
Custom Event

 

 

 

 

aishoppingassistant_message

{{aishoppingassistant.message}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_messageSent

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_messageSent

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.messageSent
Custom Event

 

 

 

 

aishoppingassistant_message

{{aishoppingassistant.message}}

 

 

 

 

aishoppingassistant_is_suggested_text

{{aishoppingassistant.isSuggestedText}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_productRecommended

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_productRecommended

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.productRecommended
Custom Event

 

 

 

 

aishoppingassistant_message

{{aishoppingassistant.message}}

 

 

 

 

aishoppingassistant_products

{{aishoppingassistant.products}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_productClick

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_productClick

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.productClick
Custom Event

 

 

 

 

aishoppingassistant_product_id

{{aishoppingassistant.productId}}

 

 

 

 

aishoppingassistant_product_name

{{aishoppingassistant.productName}}

 

 

 

 

aishoppingassistant_product_position

{{aishoppingassistant.productPosition}}

 

 

 

 

aishoppingassistant_product_price

{{aishoppingassistant.productPrice}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_addToCart

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_addToCart

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.addToCart
Custom Event

 

 

 

 

aishoppingassistant_product_id

{{aishoppingassistant.productId}}

 

 

 

 

aishoppingassistant_product_name

{{aishoppingassistant.productName}}

 

 

 

 

aishoppingassistant_product_price

{{aishoppingassistant.productPrice}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_restart

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_restart

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.restart
Custom Event

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_closed

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_closed

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.closed
Custom Event

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

 

image-20250401-030947.png

PDP GA4 Tags

Tag name

Taq type

Configuration Tag

Event Name

Event Parameter Name

Value

Trigger (as per Step 2b)

Tag name

Taq type

Configuration Tag

Event Name

Event Parameter Name

Value

Trigger (as per Step 2b)

GA4 aishoppingassistant_pdp_view

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_pdp_view

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.pdp.view
Custom Event

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_pdp_externalTrigger

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_pdp_externalTrigger

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.pdp.externalTrigger
Custom Event

 

 

 

 

aishoppingassistant_message

{{aishoppingassistant.message}}

 

 

 

 

aishoppingassistant_trigger_type

{{aishoppingassistant.triggerType}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_pdp_1stMessageSent

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_pdp_1stMessageSent

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.pdp.1stMessageSent
Custom Event

 

 

 

 

aishoppingassistant_message

{{aishoppingassistant.message}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_pdp_messageSent

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_pdp_messageSent

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.pdp.messageSent
Custom Event

 

 

 

 

aishoppingassistant_message

{{aishoppingassistant.message}}

 

 

 

 

aishoppingassistant_is_suggested_text

{{aishoppingassistant.isSuggestedText}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_pdp_productRecommended

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_pdp_productRecommended

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.pdp.productRecommended
Custom Event

 

 

 

 

aishoppingassistant_message

{{aishoppingassistant.message}}

 

 

 

 

aishoppingassistant_products

{{aishoppingassistant.products}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_pdp_productClick

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_pdp_productClick

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.pdp.productClick
Custom Event

 

 

 

 

aishoppingassistant_product_id

{{aishoppingassistant.productId}}

 

 

 

 

aishoppingassistant_product_name

{{aishoppingassistant.productName}}

 

 

 

 

aishoppingassistant_product_position

{{aishoppingassistant.productPosition}}

 

 

 

 

aishoppingassistant_product_price

{{aishoppingassistant.productPrice}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_pdp_addToCart

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_pdp_addToCart

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.pdp.addToCart
Custom Event

 

 

 

 

aishoppingassistant_product_id

{{aishoppingassistant.productId}}

 

 

 

 

aishoppingassistant_product_name

{{aishoppingassistant.productName}}

 

 

 

 

aishoppingassistant_product_price

{{aishoppingassistant.productPrice}}

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

GA4 aishoppingassistant_pdp_restart

Google Analytics: GA4 Event

(Select your GA4 variable within GTM)

aishoppingassistant_pdp_restart

aishoppingassistant_page

{{aishoppingassistant.page}}

aishoppingassistant.pdp.restart
Custom Event

 

 

 

 

User Properties

 

 

 

 

 

aishoppingassistant_user

{{aishoppingassistant.visitorId}}{{aishoppingassistant.sessionId}}

These events now need to be configured in GA4.

3b. Mapping your Custom events into GA4

Each GTM event will automatically fire into GA4 however you now need to set up the additional ‘values’ sent with each event.

  • In GA4 > Admin > Property Settings > Data Display > Custom definitions

  • Create custom dimension

    image-20240216-031140.png
  • Then add each of these values for these events. (You can add custom dimensions for the PDP if needed)

Dimension name

Scope

Description

Event parameter
*note, must match your GTM parameter names!

Dimension name

Scope

Description

Event parameter
*note, must match your GTM parameter names!

aishoppingassistant_page

Event

Which page the AI shopping assistant was on

aishoppingassistant_page

aishoppingassistant_message

Event

What message was sent to the AI shopping assistant

aishoppingassistant_message

aishoppingassistant_trigger_type

Event

What trigger type triggered in external trigger

aishoppingassistant_trigger_type

aishoppingassistant_is_suggested_text

Event

When a message is from suggested text

aishoppingassistant_is_suggested_text

aishoppingassistant_products

Event

What products are recommended to user

aishoppingassistant_products

aishoppingassistant_product_id

Event

The unique ID of the clicked product

aishoppingassistant_product_id

aishoppingassistant_product_name

Event

The name of the clicked product

aishoppingassistant_product_name

aishoppingassistant_product_position

Event

The rank position of the clicked product in the product recommendation

aishoppingassistant_product_position

aishoppingassistant_product_price

Event

The price of the clicked product

aishoppingassistant_product_price

aishoppingassistant_user

User

The user who interacted with the AI shopping assistant

aishoppingassistant_user

image-20250401-033316.png

Make sure the event parameter names are identical to your GTM parameter Names.
Note, all are Event scoped except for preezie_user.

image-20250401-033657.png

That’s it!

Note: It can take up to 24 hours for these events to show within your GA4.

Remember to submit/publish your tag manager changes so it can become active.

Step 4: How to use the data in GA

These events will give you the ability to segment/group behaviour.

But you can also breakdown by matching exactly/partially on the text of the values, e.g.

  • Engagement with AI shopping assistant i.e. how many users opened the AI shopping assistant when it was loaded?

  • Which pages are most engaging?

  • Which products are more frequently clicked on

A full event definition guide can be found here: Using Data Layer with AI shopping assistant

 Related articles

Some additional reading:

https://support.google.com/tagmanager/answer/6164391?hl=en

https://support.google.com/analytics/answer/10085872?hl=en

Related content