I am currently working on a Nuxt3 project and I need to integrate a script delivered by Axeptio (cookie platform).
I made Nuxt3 plugin to use their script integration
export default defineNuxtPlugin((useNuxtApp) => {
;(<any>window).axeptioSettings = {
clientId: '...',
cookiesVersion: '...',
}
;(function (d, s) {
var t:any = d.getElementsByTagName(s)[0],
e: any = d.createElement(s)
e.async = true
e.src = '//static.axept.io/sdk.js'
t.parentNode.insertBefore(e, t)
})(document, 'script')
})
but this throws
Uncaught TypeError: Cannot read properties of undefined (reading 'REACT_APP_SC_ATTR')
So I tried in a Nuxt2 and it is working normally.
What can I do to make it work ?