Skip to content

Tracking issues across subdomains #1010

@deammer

Description

@deammer

I'm running into problems when tracking users across subdomains with this SDK.

My user flow:

  1. customer visits my.domain.com. mParticle.init() is called when the page loads.
  2. customer picks a product to buy
  3. customer logs in and mParticle.login() is called, resulting in the correct user_identities being sent alongside future mParticle events
  4. customer is redirected to www.domain.com to complete checkout. mParticle.init() is called when the page loads.

Expected result: the user_identities object contains our user's customerid.

Actual result: the user_identities object is empty.

The initializing code looks like this on the www.domain.com subdomain:

import mParticle from '@mparticle/web-sdk';

const mParticleConfig = {
  deviceId: '...',
  workspaceToken: '...',
  identifyRequest: {
    userIdentities: {
      // The value below comes from a cookie. I verified that
      // it is valid before building this config object.
      customerid: "12345678",
    }
  },
  dataPlan: {
    planId: '...',
  },
};

mParticle.init("api id goes here", mParticleConfig);

If I reload the page at this point, the next mParticle.init() call will work as expected. Could you help me figure out whether this is a user error or a bug in the SDK? Does the SDK maintain some kind of persistence layer that carries over between subdomains and would prevent the identifyRequest field from taking effect?

Thank you in advance 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions