Description
Context
I have a webpage that is sometimes embedded in a native app (webview). I want to utilise this package to send all events via the native app.
Why: I think it would be better if the native app can attach context about device ID (etc) rather than relying on cookies/id's set in the webview (our GA struggled with this)
Problem
The tracking implemented for the webpage uses Snowplow.addPlugin
, but this package does not support addPlugin
. How do/should I work around this?
Solutions
Plugin
Initially I thought I could create a plugin that forwarded all events to this packages trackSelfDescribingEvent
. However the information received in beforeTrack
and/or afterTrack
does not appear to be trivial to convert back into Snowplow.trackPageView(...)
or Snowplow.trackSelfDescribingEvent(..)
(atleast I don't think it is trivial).
Wrapping
The second option I see would be to create a custom wrapper around Snowplow.trackSelfDescribingEvent(...)
that also calls the trackSelfDescribingEvent from this package. It seems a bit hacky, so I wanted to hear if there was a better way to do this.
My preferred solution would be the plugin approach, but I'm open to any suggestions.
I also think I would need a way to stop the original event from being tracked, so that I do not create duplicate events. I guess I could get around this by setting the collector
url to a non-existing url.