snowplow / snowplow/snowplow-javascript-tracker

Develop and test an enableDarkSocial function

Open
#446 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

category:browser category:events priority:low type:enhancement
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:

  1. Adding a element to a URL e.g. a url fragment or querystring parameter
  2. Tracking the URL that is added to the fragment
  3. 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
  4. 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):

  1. Use the existing page view ID. (We already have a unique ID generated with every page view) as a shareToUrlId
  2. Have a JS process that checks if the current page is a shared page (i.e. there is already a suitably formatted shareToUrlId in the URL as a fragment or name/value pair on the querystring)
  3. If there is not, then add one to the page URL using the HTML5 pushState API and track an addShareIdToUrl event with the page view ID
  4. If there is a URL, then fire a foundShareIdOnUrl event 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:

  1. How should we modify the URL (querystring or fragment?) Why has Buzzfeed gone with a fragment?
  2. Should we be tracking addShareIdToUrl and readShareIdFromUrl as 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.