Skip to content

Invalid client_session entity with multiple trackers #1374

Open
@dkbrkjni

Description

Describe the bug
When using two trackers(A and B) on the same page and tracker A have configured:

anonymousTracking: {
    withSessionTracking: true,
}

tracker B attaches an invalid client_session entity (iglu:com.snowplowanalytics.snowplow/client_session/jsonschema/1-0-2) to all events. The entity is invalid due to the userId is empty string.
Tracker A sets a valid client_session entity with userId : "00000000-0000-0000-0000-000000000000"

To Reproduce

  • Initialize two trackers from v4 package on a simple webpage:
import { newTracker, trackPageView } from '@snowplow/browser-tracker';

const tracker_a = newTracker('tracker_a', 'https://a.example.com', {
  appId: 'my-app',
  contexts: {
    session: true,
  },
  anonymousTracking: {
    withSessionTracking: true,
  },
});

const tracker_b = newTracker('tracker_b', 'https://b.example.com', {
    appId: 'my-app',
    contexts: {
      session: true,
    },
  });

  trackPageView();
  • Load the webpage in a browser

Expected behavior
Two page views send with the client_session entity attached. Both of them should be valid.

Actual behaviour
Two page views send with the client_session entity attached. tracker_b's client_session entity is invalid because userId is empty string.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Edge
  • Version 130.0.2849.68

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
If setting the cookieName to different values on the two trackers this bug seems to go away.

Metadata

Assignees

No one assigned

    Labels

    type:defectBugs or weaknesses. The issue has to contain steps to reproduce.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions