Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (@jitsu/js): Add defaultPayloadContext to include default context in all requests #1156

Merged

Conversation

dmeremyanin
Copy link
Contributor

This PR introduces a new property defaultPayloadContext to the configuration. It allows default context data (e.g., browser timezone, some extra user identifier) to be automatically included in every request's payload.

Example Usage

window.jitsuConfig = {
  defaultPayloadContext: {
    browserTz: Intl.DateTimeFormat().resolvedOptions().timeZone,
    userIdentity: getUserIdentity(),
  }
}

The values of browserTz and userIdentity will now be included in the payload of every request, ensuring that the common context data is consistently available in all API calls, without needing to manually include them with each request.

@dmeremyanin dmeremyanin force-pushed the jitsu-js-default-payload-context branch from ab70eb5 to ee4ca19 Compare December 17, 2024 08:28
@dmeremyanin dmeremyanin requested a review from absorbb December 17, 2024 08:31
@dmeremyanin dmeremyanin force-pushed the jitsu-js-default-payload-context branch from ee4ca19 to db98c52 Compare December 17, 2024 09:15
@dmeremyanin dmeremyanin force-pushed the jitsu-js-default-payload-context branch from db98c52 to 97e5460 Compare December 17, 2024 09:19
@dmeremyanin dmeremyanin requested a review from absorbb December 17, 2024 09:22
@absorbb absorbb merged commit 1016c3a into jitsucom:newjitsu Dec 17, 2024
1 of 4 checks passed
@dmeremyanin
Copy link
Contributor Author

@absorbb thanks for the prompt review of all the PRs. Also, just wondering - when can we expect a new release with the latest changes?

@absorbb
Copy link
Contributor

absorbb commented Dec 17, 2024

Usually we make a release to fix some critical issue or when we collected significant amount of minor changes.
But these changes are already in beta images. So you can switch to beta until we issue another release.

@dmeremyanin
Copy link
Contributor Author

Got it, thanks for the clarification. We will switch to the beta images in the meantime.

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.

2 participants