segmentio / consent-manager

Drop-in consent management plugin for analytics.js
https://segmentio.github.io/consent-manager/
MIT License
341 stars 144 forks source link

Unclear how to implement segment spec post-install #177

Closed dskvr closed 3 years ago

dskvr commented 3 years ago

When attempting to use any analytics method, such as analytics.page(), the following error is returned:

VM184:1 Uncaught ReferenceError: analytics is not defined
    at <anonymous>:1:1

I've read through the readme several times, and this fairly important detail does not appear to be covered. The .page() method is referenced twice, once in the nextjs example and another isolated example for anonymous user IDs (which would predictably also throw this error)

I have inspected the DOM and document variables, and cannot locate an instantiated analytics anywhere, before or after GDPR configuration.

Please consistently demonstrate how to implement segment spec for reactjs and standalone as you did for nextjs

Thank you.

dskvr commented 3 years ago

This was my mistake, I misread the README as I interpreted the consent-manager as responsible for injecting analytics.js