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: accept custom session id parameter in config #485

Merged
merged 1 commit into from
Jan 20, 2022

Conversation

kevinpagtakhan
Copy link
Contributor

Summary

This change allows custom session id to be defined on init() by passing in config object.

EXAMPLE
amplitude.init(API_KEY, USER_ID, {
  sessionId: Date.now(),
});

config.sessionId is optional and defaults to null. If options.sessionId is null or not a valid session id, the session id will be set to the session id from metadata storage if it exists; otherwise will be assigned a new one. If options.sessionId, it will be set as the session id.

Prior to this change, devs must call init() then setSessionId() to pass a custom session id.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

Copy link
Contributor

@justin-fiedler justin-fiedler left a comment

Choose a reason for hiding this comment

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

👍

@kevinpagtakhan kevinpagtakhan merged commit b64b8b0 into main Jan 20, 2022
@kevinpagtakhan kevinpagtakhan deleted the AMP-34640-options-session-id branch January 20, 2022 05:41
github-actions bot pushed a commit that referenced this pull request Jan 21, 2022
# [8.16.0](v8.15.1...v8.16.0) (2022-01-21)

### Bug Fixes

* catch errors with Request.send ([#490](#490)) ([333f8a4](333f8a4))

### Features

* accept custom session id paramter in config ([#485](#485)) ([b64b8b0](b64b8b0))
* allow cors header to be excluded from request headers ([#489](#489)) ([0119ac7](0119ac7))
@github-actions
Copy link

🎉 This PR is included in version 8.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants