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: Update support for segment analytics #1119

Merged
merged 6 commits into from
Apr 16, 2024

Conversation

benjackwhite
Copy link
Collaborator

@benjackwhite benjackwhite commented Apr 8, 2024

Changes

Fixes #1106

Annoyingly Segment's documentation does not match reality. They claim that the Analytics JS will always have non-promise responses once it is ready but this isn't the case.

  • Changes the Segment setup to all happen in one function
  • Accounts for the User object being a promise or not
  • Handles both distinct_id and device_id

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)

@benjackwhite benjackwhite requested a review from pauldambra April 16, 2024 08:06
@benjackwhite benjackwhite marked this pull request as ready for review April 16, 2024 08:06
# Conflicts:
#	src/posthog-core.ts
Copy link

github-actions bot commented Apr 16, 2024

Size Change: +1.54 kB (0%)

Total Size: 962 kB

Filename Size Change
dist/array.full.js 230 kB +392 B (0%)
dist/array.js 127 kB +383 B (0%)
dist/es.js 128 kB +383 B (0%)
dist/module.js 128 kB +383 B (0%)
ℹ️ View Unchanged
Filename Size
dist/exception-autocapture.js 12.2 kB
dist/recorder-v2.js 108 kB
dist/recorder.js 108 kB
dist/surveys-module-previews.js 62 kB
dist/surveys.js 58.3 kB

compressed-size-action

@benjackwhite benjackwhite requested a review from robbie-c April 16, 2024 08:13
Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

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

🚢

src/extensions/segment-integration.ts Outdated Show resolved Hide resolved
@benjackwhite benjackwhite added the bump patch Bump patch version when this PR gets merged label Apr 16, 2024
@benjackwhite benjackwhite merged commit 5b474c2 into main Apr 16, 2024
11 checks passed
@benjackwhite benjackwhite deleted the feat/support-analytics-2.0 branch April 16, 2024 13:32
Copy link
Member

@robbie-c robbie-c left a comment

Choose a reason for hiding this comment

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

LGTM

edit: lol too slow

@kamui
Copy link

kamui commented Apr 16, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch Bump patch version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PostHog JS SDK not compatible with Segment analytics-next package
4 participants