question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bump / Upgrade Snowplow to v3 (RENAMED)

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
paulboocockcommented, Sep 21, 2021

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.

1reaction
paulboocockcommented, Aug 25, 2021

So it’ll work fine in most cases, any API call with no parameters will be 100% ok:

        instance.plugins.snowplow.enableLinkClickTracking()
        instance.plugins.snowplow.enableFormTracking()

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:

        instance.plugins.snowplow.enableActivityTracking({
            minimumVisitLength: 30,
            heartbeatDelay: 10,
        })

However, if you’re using TypeScript then this won’t compile because you’ll get a type error. In @analytics/snowplow, currently the definition of enableActivityTracking is:

      /**
       * Enables Activity Tracking https://bit.ly/3hBM6QK
       * Generates page ping events based on user activity on page
       * Should be called before first page view event
       * @param {number} [minimumVisitLength] - Minimum visit length before first page ping event fires
       * @param {number} [heartbeat] - Period where user must be active to fire the next page ping
       */
      enableActivityTracking(minimumVisitLength, heartbeat) {
        const { name } = config;
        snowplow(
          `enableActivityTracking:${name}`,
          minimumVisitLength,
          heartbeat
        );
      },

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 the snowplow() 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.

window.snowplow('addPlugin', 
  "https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-debugger@latest/dist/index.umd.min.js",
  ["snowplowDebugger", "DebuggerPlugin"],
  [ 4 ] // 4 = Info logs
);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Releases · snowplow/dbt-snowplow-web - GitHub
To upgrade simply bump the snowplow-web version in your packages.yml file. You will need dbt v1.3 at least to be able to use...
Read more >
Level kit or just add new bump stops - Snow Plowing Forum
I just upgraded my springs to heavy duty ones. The only thing that will help IMO. Adding leveling kit doesn't help that the...
Read more >
MassDOT Announces New “Name A Snowplow” Contest for ...
The contest seeks to solicit names for 12 MassDOT snowplows that will be in service for the upcoming 2022/2023 winter season.
Read more >
Eliminate front end sagging with extra suspension support
In this video, we explain some different options for supporting the front end of your plow truck to prevent sag and bottoming out....
Read more >
Contract Agreement for Snow Plowing and Hauling Services
3. The state, its officers and employees as named additional insured. 4. Automobile liability limits as described above. 5. Workers compensation limits ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found