launchdarkly / js-client-sdk

LaunchDarkly Client-side SDK for Browser JavaScript
Other
109 stars 62 forks source link

SDKs >= 3.0.0 no longer send click or pageview events #275

Closed seanr-cardless closed 1 year ago

seanr-cardless commented 1 year ago

Describe the bug SDKs >= 3.0.0 are no longer sending click or pageview events.

To reproduce

  1. Use SDK > 3.0.0
  2. Set up an experiment with a pageview event as the conversion metric
  3. Start recording the experiment
  4. Try triggering an action that would send the pageview event
    • Nothing will be sent

Expected behavior A pageview or click event should be sent.

Logs No applicable logs, but I can confirm that I see pageview and click conversions coming in as a response from the SDK goals response so it is not an issue with how things are set up in Launch Darkly.

SDK version 3.1.2

Language version, developer tools Node 18.15

OS/platform MacOS Ventura 13.3, Chrome 112.0.5615.49

Additional context

This issue arose in the 3.0.0 release where contextKeys was added to the event payload but context was not. When enqueuing an event, js-sdk-common does not send any events without the context key in the payload.

Because the 3.0.0 release of this SDK added contextKeys but not context to the payload, click, pageview, or click_pageview events are no longer sent.

Note that we are using this SDK through the React client SDK (version 3.0.4) but I believe this root cause is an issue both using this SDK standalone or through React.

kinyoklion commented 1 year ago

Fixed in 3.1.3. Thanks @seanr-cardless!