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 decide toggle #1857

Merged
merged 3 commits into from
Oct 30, 2024
Merged

Feat decide toggle #1857

merged 3 commits into from
Oct 30, 2024

Conversation

andresz1
Copy link
Member

@andresz1 andresz1 commented Oct 29, 2024

Description

This PR:

  • Enables useDecision to prevent sending impression tracking events to both Optimizely and Segment by setting isEventDisabled to true
  • Introduces a new hook, useDecisionCallback, which allows for programmatic calls to decide, making it useful for user event callbacks.

Related Issue

Example

const {decide} = useDecisionCallback()

const handleClick = () => {
  const data = decide('x')
}
const {decide} = useDecision('x', { isEventDisabled: true }) 
// impression won't be tracked

@andresz1 andresz1 marked this pull request as ready for review October 30, 2024 13:47
* Hook to call decide
* @return {function}
*/
export default function useDecisionCallback() {
Copy link
Member Author

@andresz1 andresz1 Oct 30, 2024

Choose a reason for hiding this comment

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

This allows the decide function to be called programmatically, which is useful for very specific use cases. 99% of cases useDecision will be just fine

@andresz1 andresz1 merged commit fd6f587 into master Oct 30, 2024
2 checks passed
@andresz1 andresz1 deleted the feat-decide-toggle branch October 30, 2024 14:22
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.

5 participants