snowplow / snowplow/snowplow-javascript-tracker

Async initial check

Open
#1,393 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:enhancement
Dominant language
TypeScript
Stars
590
Forks
232
Avg merge
2h 22m
Merged PRs (30d)
3

Description

Is your feature request related to a problem? Please describe.
We need to ensure which country the request originates from before tracking is enabled. This is done using a server side check.
The issue we are facing is that we want to start collecting events as soon as possible, but if the response from the server is delayed then we might miss some initial tracking calls.

Describe the solution you'd like
Ideally we should be able to enable the tracking but be able to postpone sending the events. Based on the response we would either send off the and return to normal tracking or drop the events and disable the tracker.

Describe alternatives you've considered

  • Creating custom event emitter - we could have a lot more control over how events are sent and if they are saved in the events store - emitter is async in it’s nature so it would be really easy to hook into a pipeline with our allowed countries check
  • custom events store - we can block events from being retrieved from a store by creating our own custom implementation. Drawback is that in my opinion the event store should be a “dumb” component and shouldn’t be used to decide whether we can track or not.
    Additionally we still need to block events that are to big for an events store - either with do not track cookie either with custom fetch

Additional context

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

The issue names no files or tests; start by tracing tracker initialization, the event emitter, and event-store flow. Define how initial events are held while the server-side country check is pending, then verify that allowed requests resume normal tracking while disallowed requests drop queued events and disable the tracker.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
analytics, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.