Skip to content

Conversation

@Spencer-Smith
Copy link
Collaborator

Description

Removes event timestamp during event finalization and adds a meta property to determine the amount of time the event was enqueued.

Related Issue

Jira

Motivation and Context

Timestamps from the WebSDK are dependent on user device settings and so can be inaccurate. In order to avoid TIME DRIFT in Konductor, we should no longer send event timestamps in the SDK. Instead, Konductor will insert the timestamp when the request is received. Because send event commands can be queued (while they wait for script load, consent, identity, etc.), we need to track the delta between when the command is enqueued and when it is actually sent to determine in Konductor when the event occurred.

Screenshots (if appropriate):

N/A

Checklist:

  • I have signed the Adobe Open Source CLA or I'm an Adobe employee.
  • I have made any necessary test changes and all tests pass.
  • I have run the Sandbox successfully.

event.mergeData(userData);
}

if (content?.xdm?.timestamp) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think so but it seems there's always an exception and a million ways clients or their users might mess with the structure 😅


expect(event.meta.queueTimeMillis).toBeGreaterThanOrEqual(0);
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add tests for known conditions where the event would be queued:

  • Waiting for consent - (configured with defaultConsent=pending, sendEvent, sleep, setConsent)
  • Running events close together - (3 sendEvents), first should be sent immediately, second and third will wait for first to return so that identity is established.

Also somewhere we should add integration tests that use timestamp strings that customers have actually gotten for the timestamp as invalid. You may be able to use vi.spyOn(Date, "new") to provide mock data. Look through the linked tickets for PLATIRs and data customers have run into.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an integration test for the first case. For the second case see discussion in slack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants