Using cloudflare with segement consent manager - no analytics anymore

Hello,

I am using the segment consent manager: GitHub - segmentio/consent-manager: Drop-in consent management plugin for analytics.js

Loaded from unpkg.com and appended to the end of the site.

The main issue is: When Cloudflare is enabled the consent manager just flashes meaning it gets shown for a few seconds and then disappears. Everything works perfectly fine when I enter “development mode”, but as soon as it gets reactivated the same behavior reappears.

My first suspicion was that the “rocket loader” interferes with the loading of the asset, but that didn’t help. I also purged caches which didn’t help. Only completely by passing the cache makes the manager work as expected.

Implementation details are:

The js gets loaded in the following way:

<script data-n-head="ssr" src="https://unpkg.com/@segment/[email protected]/standalone/consent-manager.js" defer data-body="true">

Before that in the code I am registering the config for manager in “window.Consetmanager = {}”.

I am using nuxt as a server and obviously vue as frontend.

I am out of ideas where to look. Anybody having a recommendation what I could disable?

Regards
Stefan Hesse

Thats a good point and often the reason for issues in such a case, however apparently not here.

Whats the domain?

Have you tried minification already?

Thank you! The minification caused the trouble.