Hi, I'm currently facing an issue with `client.set` not being executed when called from a custom ma

Hi, I'm currently facing an issue with client.set not being executed when called from a custom managed component in a custom action. It works, if I call it in an event handler for the default "Pageview" action, but not in any event handler for a custom action. In my example below, the value for the event "detailedPageview" is always null, for the "pageview" event the value is set after first execution.
export default async function (manager: Manager, _settings: ComponentSettings) {
manager.addEventListener('detailedPageview', async event => {
const { client } = event
let getResponse = client.get('key2')
console.log('getResponse', getResponse)
// ^ this always logs null
client.set('key2', 'value2')
getResponse = client.get('key2')
console.log('getResponse', getResponse)
})

manager.addEventListener('pageview', async event => {
const { client } = event
let getResponse = client.get('key')
console.log('getResponse', getResponse)
// ^ this one logs the value, once it has been set
client.set('key', 'value')
getResponse = client.get('key')
console.log('getResponse', getResponse)
})
}
export default async function (manager: Manager, _settings: ComponentSettings) {
manager.addEventListener('detailedPageview', async event => {
const { client } = event
let getResponse = client.get('key2')
console.log('getResponse', getResponse)
// ^ this always logs null
client.set('key2', 'value2')
getResponse = client.get('key2')
console.log('getResponse', getResponse)
})

manager.addEventListener('pageview', async event => {
const { client } = event
let getResponse = client.get('key')
console.log('getResponse', getResponse)
// ^ this one logs the value, once it has been set
client.set('key', 'value')
getResponse = client.get('key')
console.log('getResponse', getResponse)
})
}
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?