I have tried to set up the snowplow tracker (using @analytics/snowplow) for the next js project which is not as simple as just copying the code snippet to the header.
I have created a simple project with “try snowplow” to see if I can trigger the track event. I get the collector url from Try snowplow.
It also looks like you’re initialising multiple times, the tracker is ok with this but worth considering this within a SPA application, as its a potential route to bugs in the future.
Lastly, the getanalytics.io is a good package, but it still requires you to load an additional asset at runtime (sp.js).
If that does fix things for you (and hopefully it does!) you might want to consider, particularly for future development, moving to a Snowplow JavaScript v3 tracker, such as our Browser Tracker. It’s pretty much the same but becomes part of your application, rather than loading sp.js externally. We have deprecated forceSecureTracker in v3, you simply put https:// before your collectorUrl.
Hi Paul,
We have tried to link our client’s website to Snowplow recently. But it still shows the error that the client’s website is blocked by the CORS policy.
I added the “https://” before collectorUrl. It was running well for my test app with the try snowplow trial but not the client website. Can you think of any potential problem that causing this error (CORS)?
For your information, we are using the Snowplow JavaScript v3 tracker (Browser Tracker).