Difference between revisions of "ATC/Current/SDK/Use Events methods with web actions"

From Genesys Documentation
Jump to: navigation, search
m (Text replacement - "\|Platforms?=([^\|]*)PureEngage([\|]*)" to "|Platform=$1GenesysEngage-onpremises$2")
m (Text replacement - "Genesys Cloud" to "Genesys Cloud CX")
 
(6 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
|Dimension=WebActions
 
|Dimension=WebActions
 
|ComingSoon=No
 
|ComingSoon=No
|Platform=GenesysEngage-onpremises, PureConnect, PureCloud
+
|Platform=PureConnect, GenesysCloud, GenesysEngage-cloud
|Prereq=
 
 
|Section={{Section
 
|Section={{Section
 +
|alignment=Vertical
 +
|structuredtext={{NoteFormat|1=This article only applies to customers using {{Link-AnywhereElse|product=ATC|version=Current|manual=AdminGuide|topic=About_web_chats|display text=web chat}}. If you are a Genesys Cloud CX customer, we encourage you to use the new {{Link-AnywhereElse|product=ATC|version=Current|manual=AdminGuide|topic=About_web_messaging|display text=web messaging}} feature to replace web chat.|2=}}<br />
 +
|Status=No
 +
}}{{Section
 
|sectionHeading=Event methods for web actions
 
|sectionHeading=Event methods for web actions
 
|anchor=WebActionMethods
 
|anchor=WebActionMethods
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=To capture information about events that occur during the lifecycle of a web action, use the Events methods shown in the following table.
 
|structuredtext=To capture information about events that occur during the lifecycle of a web action, use the Events methods shown in the following table.
 
{{{!}} class="wikitable"
 
{{{!}} class="wikitable"
Line 36: Line 37:
 
{{!}}}
 
{{!}}}
 
<br />
 
<br />
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
Line 43: Line 42:
 
|anchor=WebActionMediaTypes
 
|anchor=WebActionMediaTypes
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=<br />
 
|structuredtext=<br />
 
{{{!}} class="wikitable"
 
{{{!}} class="wikitable"
Line 61: Line 58:
 
{{!}}}
 
{{!}}}
 
<br />
 
<br />
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
Line 68: Line 63:
 
|anchor=EventsWebActions
 
|anchor=EventsWebActions
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=The following table lists the events that you can use with {{Link-SomewhereInThisVersion|manual=SDK|topic=Use_Events_methods_with_web_actions|anchor=WebActionMethods|display text=Events methods for web actions}}. Event information returned includes the action state, customer ID, session ID, and action map ID.   
 
|structuredtext=The following table lists the events that you can use with {{Link-SomewhereInThisVersion|manual=SDK|topic=Use_Events_methods_with_web_actions|anchor=WebActionMethods|display text=Events methods for web actions}}. Event information returned includes the action state, customer ID, session ID, and action map ID.   
 
{{{!}} class="wikitable"
 
{{{!}} class="wikitable"
Line 117: Line 110:
 
{{!}}Error message for any exceptions caught during presentation of the action.
 
{{!}}Error message for any exceptions caught during presentation of the action.
 
{{!}}}
 
{{!}}}
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
Line 124: Line 115:
 
|anchor=CaptureMore
 
|anchor=CaptureMore
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
+
|structuredtext=You can use the Web Action Events API with Genesys Widgets commands to enrich events with more data that may be useful.
|image=
 
|structuredtext=The Web Action Events API can be used with Genesys Widgets commands to enrich events with more data that may be useful.
 
  
For example, the Genesys Cloud <code>conversationId</code> may be useful in an analytics context. For more information on the Widgets API, see [https://docs.genesys.com/Documentation/GWC/Current/WidgetsAPI/WebChatServiceCommands API Commands].<syntaxhighlight lang="javascript">
+
For example, the Genesys Cloud CX <code>conversationId</code> may be useful in an analytics context. For more information on the Widgets API, see [https://docs.genesys.com/Documentation/GWC/Current/WidgetsAPI/WebChatServiceCommands API Commands].<syntaxhighlight lang="javascript">
 
ac('on', 'webchat:all', (evt) => {
 
ac('on', 'webchat:all', (evt) => {
 
   _genesys.widgets.bus.command('WebChatService.getSessionData').then((data) => {
 
   _genesys.widgets.bus.command('WebChatService.getSessionData').then((data) => {
Line 138: Line 127:
 
   })
 
   })
 
});
 
});
</syntaxhighlight>{{NoteFormat|The data returned by WebChatService.getSessionData will differ based on your Genesys platform.}}
+
</syntaxhighlight>{{NoteFormat|The data that WebChatService.getSessionData returns differs based on your Genesys platform.|}}
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}
 
}}
 
}}
 
}}

Latest revision as of 21:27, November 9, 2021

This topic is part of the manual Journey JavaScript SDK for version Current of Genesys Predictive Engagement.

Use Events methods to subscribe to events that occur during the lifecycle of Genesys Predictive Engagement web actions such as web chats and content offers. This raw data can be streamed to third-party analytics platforms or to tag management platform data layers for use in analytics and reporting platforms.

Important
This article only applies to customers using web chat. If you are a Genesys Cloud CX customer, we encourage you to use the new web messaging feature to replace web chat.

Event methods for web actions

To capture information about events that occur during the lifecycle of a web action, use the Events methods shown in the following table.

Method Description

on

Subscribe to start receiving events for a given type of web action in a given state.

once

Receive events for only the first occurrence of a given type of web action in a given state.

off

Unsubscribe to stop receiving events for a given type of web action in a given state.


Media types, lifecycle states, and code examples using Events methods

Event types for web actions

The following table lists the events that you can use with Events methods for web actions. Event information returned includes the action state, customer ID, session ID, and action map ID.

Event Data type Description
actionId UUIDv4 Unique Id for a specific Predictive Engagement action.
actionState String Current state of the action. For example, offered.
actionMediaType String The engagement type. For example, webchat.
actionMapId UUIDv4 Id of the action map that qualified/triggered this action.
actionMapVersion Integer Version of the action map.
customerId UUIDv4 Stable identifier of the customer. For example, a cookie Id.
customerIdType String The specific type of customer identifier (always "cookie").
sessionId UUIDv4 Identifier of the customer's current web session.
errorCode Integer Status code for any exceptions caught during presentation of the action.
errorMessage String Error message for any exceptions caught during presentation of the action.

Capture more data with Genesys widgets

You can use the Web Action Events API with Genesys Widgets commands to enrich events with more data that may be useful.

For example, the Genesys Cloud CX conversationId may be useful in an analytics context. For more information on the Widgets API, see API Commands.
ac('on', 'webchat:all', (evt) => {
  _genesys.widgets.bus.command('WebChatService.getSessionData').then((data) => {
    if (data.conversationId) {
      evt.conversationId = data.conversationId;
    }

    someAnalyticsProvider.send(evt);
  })
});
Important
The data that WebChatService.getSessionData returns differs based on your Genesys platform.
Comments or questions about this documentation? Contact us for support!