#Segment Consent Manager...anyone have success?

17 messages · Page 1 of 1 (latest)

hearty ore
#

Hey all. Working on getting Segment integrated correctly with my Next.js project (using v12), and I've been hitting dead ends every direction. Dropping in the Segment snippet works just fine, but I would like to integrate it with Segment's Consent Manager (@segment/consent-manager). Unfortunately, it seems to not be as drag-and-drop as the documentation claims, and I've been banging my head against the wall for the last 48 hours with zero results.

Does anyone have a functioning version of Segment's Consent Manager with Next, and would be willing to share the solution? Thanks.

hollow socket
#

I have no idea what is this, but what is the error you are receiving?

hearty ore
#

Others have reported this is due to a client-side vs. server-side issue, though even with solutions like loading with next/dynamic the error clears but the problem is not solved.

hollow socket
#

are you using next 12 or higher?

hearty ore
#

Next 12

hollow socket
#

it looks like its something that should be fixed in the library itself

#

worst case scenario if they don't update it, you could try using next-transpile-modules to fix it in your codebase

hearty ore
#

Tried that, it produces no results either unfortunately.

#

They did update it for this issue, but even on clean Next installs the problem persists. Hence why I was looking for anyone who used Segment and had solved the problem.

#

Definitely a strange one.

hot monolith
#

You find a solution?

hearty ore
#

Yeah...ended up not using their consent management library.

#

Going with a different cookie consent method.

acoustic haven
#

@hearty ore what library did you end up going with? I'm currently doing some r&d for integrating Segment with a new eCommerce site.

hearty ore
#

Yeah I ended up using react-consent-cookie and spun up my own banner, and once accepted it loads in Segment Analytics.js via @segment/snippet

#

No granular consent management but their library is definitely not compatible with Next as of now.

acoustic haven
#

thanks @hearty ore -- will check that out. It's looking to me like integrating the segment sdks w/ Next are not as 'batteries included' as I thought 😦