snowplow / snowplow/snowplow-javascript-tracker
Develop and test an enableDarkSocial function
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 590
- Forks
- 232
- Avg merge
- 2h 22m
- Merged PRs (30d)
- 3
Description
Original issue was part of the Snowplow project i.e. was raised a very long time ago before the JS tracker was a standalone project.
The idea is to enable Snowplow users to track social shares the same way that sites like Buzzfeed do them, by:
- Adding a element to a URL e.g. a url fragment or querystring parameter
- Tracking the URL that is added to the fragment
- When a user shares the URL (by any channel, but including social / email / IM / bookmark etc.) fetch the element that is added into its own derived context
- At the data modeling step build out the graph of referrals described in the Buzzfeed post
The Snowplow pipeline has evolved significantly since the original issue was raised. My initial suggestion (but only a suggestion - let's iterate the approach in this ticket):
- Use the existing page view ID. (We already have a unique ID generated with every page view) as a
shareToUrlId - Have a JS process that checks if the current page is a shared page (i.e. there is already a suitably formatted
shareToUrlIdin the URL as a fragment or name/value pair on the querystring) - If there is not, then add one to the page URL using the HTML5 pushState API and track an
addShareIdToUrlevent with the page view ID - If there is a URL, then fire a
foundShareIdOnUrlevent with the relevant ID captured from the URL
In addition we would then have a separate enrichment process that fetches the ID from the URL and loads it into a derived context.
Finally we'd have a step that ran as part of the data modeling that built the sharing graph.
Questions / issues:
- How should we modify the URL (querystring or fragment?) Why has Buzzfeed gone with a fragment?
- Should we be tracking
addShareIdToUrlandreadShareIdFromUrlas discrete events? I think this is a good idea, because the alternative - pulling out the ID as an enrichment - and then inferring this as part of the data modeling step - is more fragile: you assume that the ID is appended where it matches the page view ID and is a shared URL otherwise. But maybe that's OK?
cc @fblundun @alexanderdean @richardfergie @kingo55 @msmallcombe
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the tracker architecture for page view IDs and event tracking, then examine how URL changes, enrichment, and data modeling are separated. Resolve whether to use a fragment or query string and whether to emit separate addShareIdToUrl and foundShareIdOnUrl events. Done means the enableDarkSocial behavior and its tests cover the agreed approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- analytics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100