
Announcements
Hi
I have hosted my PVA on an existing webpage. After the conversation ends in PVA, data is pushed to Dynamics (using power automate).
Webpage uses ga client id (Googla Analytics) to retrieve the client id. Is it possible to retrieve the client id from webpage and push it through PVA while user is engaging with the bot. We would then be pushing this id to the dynamics.
I checked for any connectors that can do this and couldn't find any.
Is there any way I can achieve this?
I tried the below
```
var gaclientid;
gtag('get', <clientid>, 'client_id', (client_id) => {
gaclientid = client_id;
var fieldList = document.getElementsByName("gaClientID");
fieldList.forEach(element => {
element.value = client_id;
});
});
const store = window.WebChat.createStore(
{},
({ dispatch }) => next => action => {
if (action.type === "DIRECT_LINE/CONNECT_FULFILLED") {
dispatch({
meta: {
method: "keyboard",
},
payload: {
activity: {
channelData: {
postBack: true,
},
//Web Chat will show the 'Greeting' System Topic message which has a trigger-phrase 'hello'
name: 'startConversation',
type: "event",
},
},
type: "DIRECT_LINE/POST_ACTIVITY",
});
store.dispatch({ type: 'WEB_CHAT/SET_SEND_BOX',
payload: { text: gaclientid ,
} });
}
return next(action);
}
);
fetch(theURL)
.then(response => response.json())
.then(conversationInfo => {
window.WebChat.renderWebChat(
{
directLine: window.WebChat.createDirectLine({
token: conversationInfo.token,
}),
store: store,
styleOptions: styleOptions
},
document.getElementById('webchat')
);
})
.catch(err => console.error("An error occurred: " + err));
```
I was able to fetch the distinct id from the web browser and get it into "SEND BOX" as shown below
However, I want this value to be stored in a variable and sent it via bot conversation without user seeing it.
This would be the unique user ID, which I will later be storing in dataverse.
Solved this by doing the below
Step 1:
In the HTML script:
Use it in the conversation flow however you want