Push events to Google Analytics 4
Smilee can push the following events to Google Analytics
agentJoined
event: Agent has joined the chat
label format: Session ID
:agent name
autoPopUpTriggered
event: Chat autopopup event has been triggered
label format: Session ID
sessionRated
event: Session has been rated
label format: Session ID
:agent name
contactFormSent
event: Contact form was sent
label format: Session ID
cookiesAccepted
event: Smilee cookie consent accepted
label format: Session ID
cookiesDeclined
event: Smilee cookie consent declined
label format: Session ID
tabClosed
event: Smilee chat UI closed
label format: Session ID
tabClicked
event: Smilee chat UI opened
label format: Session ID
videoCall
event: Smilee video call started
label format: Session ID
cobStarted
event: Smilee cobrowsing started
label format: Session ID
assistantLoaded
event: Smilee assistant UI loaded
label format: Session ID
assistantClick
event: Assistant button has been clicked
label format: Session ID
:Type of button
:Text of button
assistantClick
event: Enduser has clicked the back button of assistant
label format: Session ID
:back
Add events to script
First step is to add eventReceiver
to script running the chat
eventReceiver: function(props) {dataLayer.push(Object.assign({}, {'event': 'ChatEvent'}, props));}
Full example of script below
<!-- Smilee service script start --><script type="text/javascript" charset="UTF-8" async>(function () {var x = document.createElement('script');x.src = 'https://saas.smilee.io/assets/javascripts/cobrowse.js';x.type = 'text/javascript';x.async = 'true';x.onload = x.onreadystatechange = function () {var rs = this.readyState;if (rs && rs != 'complete' && rs != 'loaded') return;try {Cobrowse.create({apiKey: "LQt/yocAfcWRAt...",eventReceiver: function(props) {dataLayer.push(Object.assign({}, {'event': 'ChatEvent'}, props));}});} catch (e) {console.error('Failed loading Smilee script');}};var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(x, s);})();</script><!-- Smilee service script end -->
Add a trigger for Smilee events
Insert a new Trigger with a name Smilee events
Give it type Custom Event
Event name: ChatEvent
Trigger on All Custom Events
Click Save
Add variables
Go to Variables-section and add new User-Defined Variable
Select type Data Layer Variable
Give name smileechat event action
Data Layer variable name chatAction
Click Save
Configure GA4 tag
In Tags-section click to add a new tag
Select Google Analytics: GA4 Configuration
Set your Google Analytics 4 Measurement ID
Add a new trigger and select All Pages-trigger
Click Save
Create tag for pushing to Google Analytics 4
Tag type: Google Analytics: GA4 Event
Select GA4 configuration tag or set GA4 Tracking ID manually
Set smileechat event action-variable as Event Name
Set smileechat event action-variable also as Parameter Name and as Value
Set Smilee events as the trigger for this tag
Click Save
Publish the changes and you should start receiving Smilee events in Google Analytics 4
Push chat open when user is thinking about exiting the page
Coming soon