Web Messaging Participant Data

We are helping our Genesys Cloud customer migrate from Chat to Web Messaging. Currently, we are storing the following as Participant Data on Chat interactions:

OS (context._genesys_OS)
Browser (context._genesys_browser)
Source (context._genesys_source)
Page Title (context._genesys_pageTitle)

We need to store this same data with Web Messaging interactions. I found a similar topic:

Get URL on web messaging
https://developer.genesys.cloud/forum/t/get-url-on-web-messaging/24263

We added the code snippet and Web Messaging interactions now store the URL and Language. I would like to inquire if it is possible to store the above as Participant Data on Web Messaging interactions, and what other data can be stored with Web Messaging interactions using the Database.set command.

Thank you in advance.

Yes, that method is used to store any data to Participant Data. You do not need the context part anymore, it is just the key name as explained. Any data that you can find in javascript and execute the command will work. The big difference is you can execute this at any time in the browser session and not just on the page they click to start.

Hello Marc,

Thank you for replying to my topic.

In the previous related topic, you indicated the following can be used:

genesys_url: window.location.href
browser_language: navigator.language

Can you please provide the code that should be used after each of these key names:

genesys_OS:
genesys_browser:
genesys_source:
genesys_pageTitle:

Thank you in advance.

Some examples are window.navigator.userAgent to get the OS, but all of these are public javascript samples and not specific to Genesys. How did you get the values in the first place?

Thank you for that example. I believe another engineer obtained those key names when we originally implemented web chat for our customer. Would you happen to have the code/javascript for browser, source and page title? Thank you!

Sorry, if you point me to the page I can look. Examples might be:

var genesys_OS ="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) genesys_OS ="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) genesys_OS ="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) genesys_OS ="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) genesys_OS ="Linux";

as there are multiple versions.

genesys_pageTitle == document.title;
genesys_browser == navigator.appName;

Not sure what source is in this context. This isn't Genesys code and so I cannot find it for you or ask the engineer as I don't know where it came from. All the samples above are from Stack Overflow and any web developer could write them.

Thank you for providing the code/javascript for page title and browser. I updated my code as follows to include these:

Genesys("command", "Database.set", {
messaging: {
customAttributes: {
genesys_browser: navigator.appName,
browser_language: navigator.language
genesys_pageTitle: document.title,
genesys_url: window.location.href,
}
}
});

The code you provided for OS looks a bit different than the others. Where/how would I include that in my above code? Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.