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

Segment around widget-open #13

Open
thadeu opened this issue Sep 3, 2020 · 1 comment
Open

Segment around widget-open #13

thadeu opened this issue Sep 3, 2020 · 1 comment

Comments

@thadeu
Copy link

thadeu commented Sep 3, 2020

How can I set segment data before/after/around widget-open? I would like may set dynamically segment.

e.g:

<AnnounceKit
  widget="https://announcekit.app/widgets/v2/id-widget"
  user={{ id: 1234 }}
  data={{
    ...segment
  }}
  onWidgetOpen={({ widget }) => {
    const page = `${props.currentPath}${location.hash}`
    setSegment({ page })
  }}
>
  <NotificationsIcon />
</AnnounceKit>

However this dont open component, anybody know about this?

@namirali
Copy link
Contributor

@thadeu any change in data property will trigger announcekit widget to apply changes and reload. In your case changing data at onWidgetOpen stage will reload the widget with new segmentation data and lose the open state.

to segment user based on current page, would be better to listen for the url change, and change the data parameter

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

No branches or pull requests

2 participants