Bump / Upgrade Snowplow to v3 (RENAMED)
See original GitHub issueI need to be able to enable the Snowplow Debugger Plugin which seems to not ship with the snowplow tracker (sp.js) but only with their Snowplow plugins.umd.zip
@DavidWells How would the Analytics wrapper enable me to load additional Snowplow plugins that are not already included in sp.js ?
The way that the GetAnalytics seems to handle existing plugins is with the instance.plugins.snowplow.enableActivityTracking({ })
As per Snowplow documentation here they suggest to do the following
window.snowplow('addPlugin',
"https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-debugger@latest/dist/index.umd.min.js",
["snowplowDebugger", "DebuggerPlugin"]
);
When trying to do instance.plugins.snowplow.enableDebugger()
then we will get a
“AppContext.tsx:139 Uncaught (in promise) TypeError: instance.plugins.snowplow.enableDebugger is not a function”
However with instance.plugins.snowplow.enableFormTracking()
this works because it ships with sp.js
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:15 (7 by maintainers)
Hey @markojak I’m slowly making my way towards getting to this. I’ve just returned from vacation this week, but I’m optimistic I can wrap up my earlier work next week and get a PR out.
So it’ll work fine in most cases, any API call with no parameters will be 100% ok:
Anything with parameters will have changed between v2 and v3 which means all the typings are wrong in the
@analytics/snowplow
plugin now. If you’re using good ol’ JavaScript then this is fine because you can just pass the new parameter structure in:However, if you’re using TypeScript then this won’t compile because you’ll get a type error. In
@analytics/snowplow
, currently the definition ofenableActivityTracking
is:You’re getting away with it because you’re setting
minimumVisitLength
to{ minimumVisitLength: 30, heartbeatDelay: 10, }
which happens to be the second parameter passed into thesnowplow()
call in the same way as v3.heartbeat
is undefined and ultimately gets ignored in v3.So this boils down to it’ll “probably” work with v3 but I can’t guarentee it and I haven’t tested everything. So your milage may vary.
Given this still uses the global
window.snowplow
under the hood. You can actually use the debugger plugin, just outside of the npm package. If you call the snippet above it still should work, you’ll just have to make sure you call it after the@analytics
plugin has loading the Snowplow plugin. Again this is unsupported but it should work.