Closed Lewitje closed 3 years ago
I have the same problem, I have try to change the version from but the problem persists, any idea? Thanks!
Hi @Lewitje @Fernan-Ramos, could I get more information about how you are using it?
For instance
Thanks, segment team.
Hi I’m using the 5.1.0 version and the implementation is Consent Manager on react js. Instead I try to use the 5.2.0 and the 5.3.0 version but the error persists. On incognito mode the error not appear, could be related with the cookies or something similar? Thanks
I'm using:
Not sure if this is related but window.consentManager.openConsentManager()
doesn't work after the user has saved their cookie preferences, only before.
Hey @Lewitje @Fernan-Ramos, could you please check the version of your Segment Snippet? I'm suspecting you are using an outdated snippet, and therefore, the addSourceMiddleware
method is unavailable (https://github.com/segmentio/consent-manager/blob/master/README.md?plain=1#L86-L108)
Hi @Lewitje @Fernan-Ramos I agree with @pooyaj. Try adding the last version of Segment snippet documented here. https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-copy-the-segment-snippet and follow the instructions on the readme file of Consent Manager.
Segment Team.
I'm still getting the error, in google tag manager I have this snippet (with my write key replaced by the 'x'):
<script> !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e<analytics.methods.length;e++){var key=analytics.methods[e];analytics[key]=analytics.factory(key)}analytics.load=function(key,e){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.src="https://cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);analytics._loadOptions=e};analytics._writeKey="x";analytics.SNIPPET_VERSION="4.13.2"; analytics.page(); }}(); </script>
Hi @Lewitje, sorry for the late reply, your mistake is that you are adding the segment key in the code snippet and it should go in the script where you configure the consent manager.
Try again by removing the line analytics._writeKey = "x"; And adding your key in the component configuration as seen here.
Once this is done you can add the container to position your banner wherever you want.
Example:
I hope you find it useful. Regards, segment team
I get the error:
TypeError: Cannot read properties of undefined (reading 'addSourceMiddleware')