white-nest-40686
10/12/2024, 9:17 PMsession.webchatData.segments[]
or workflow.WebchatData1.segments
to find the language
- You can use session.webchatData.params
or workflow.WebchatData1.params
, followed by .
and the name of the query parameter that contains the language.
- Use the default browser language from session.webchatData.language
### Trace Campains
Using session.webchatData.params
, you can access query URL campaign data, e.g.: session.webchatData.params.utm_id
session.webchatData.params.utm_source
session.webchatData.params.utm_medium
session.webchatData.params.utm_campaign
...
## Example
js
/* session.webchatData */
{
origin: 'https://botpress.com/docs?par=abcd&num=123#pippo',
language: 'en-US', // should be 2 chars or five chars language code
referrer: 'https://botpress.com/docs', // it may be empty
params: {
par: 'abc',
num: '123'
},
segments: [
'docs',
'botpress.com',
'#pippo'
]
}
## Update
**2024.10.23**: https://discord.com/channels/1108396290624213082/1294770912155013163/1298600348952297577
https://cdn.discordapp.com/attachments/1294770912155013163/1294770912654004335/Webchat_Data.png?ex=671a10a1&is=6718bf21&hm=2351b9857fa4dbf33651b9e802b3c7a9b125283567f5c1867b27c72be3ca1ff1&white-nest-40686
10/14/2024, 1:26 PMsegments
containing the url segments, domain and fragment,
if the url is eg: https://botpress.com/docs/?par=abcd&num=123#pippo
ts
[
'docs',
'botpress.com',
'#pippo'
]
wooden-belgium-46131
10/16/2024, 12:40 PMwhite-nest-40686
10/16/2024, 12:49 PMsession.webchatData
in the same workflow during the conversation?
- When checking the variable in another workflow?wooden-belgium-46131
10/16/2024, 1:40 PMwhite-nest-40686
10/16/2024, 1:49 PMwhite-nest-40686
10/16/2024, 1:54 PMwooden-belgium-46131
10/16/2024, 2:15 PMwooden-belgium-46131
10/16/2024, 2:15 PMwooden-belgium-46131
10/16/2024, 2:17 PMwhite-nest-40686
10/16/2024, 2:20 PM{{session.webchatData}}
white-nest-40686
10/16/2024, 2:25 PMsession.webchatData.params
set to: ts
{
opcion1: 'google',
opcion9: 'direct'
}
to the value of the opcion1: session.webchatData.params.option1
wooden-belgium-46131
10/16/2024, 2:26 PMwhite-nest-40686
10/16/2024, 2:26 PMwooden-belgium-46131
10/16/2024, 2:26 PMwhite-nest-40686
10/16/2024, 2:28 PMsession.webchatData
wooden-belgium-46131
10/16/2024, 2:33 PMwooden-belgium-46131
10/16/2024, 2:33 PMwhite-nest-40686
10/23/2024, 10:54 AMevent.type === 'zx:urlDataChanged'
. Please see the image for reference.
I also updated the [JavaScript](https://jsfiddle.net/Zannax_Botpress/3jvudcf6/) because, especially in WordPress, the webchat:ready
event doesn't trigger or results in an error.
https://cdn.discordapp.com/attachments/1294770912155013163/1298600349564928020/image.png?ex=671a2752&is=6718d5d2&hm=b8813cc46658140e631c47be1d10407e4b7482cb50aa5994f4388ef272d39e74&