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

Do not send any request to Posthog if no consent is provided. #8031

Merged
merged 4 commits into from
Jan 30, 2023

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jan 30, 2023

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Ensure we never call posthog.identify if user did not consent, because it sends request <server>/decide/?v=2 to the analytic server.

Despite the fact that posthog.optout(true) has been called and no analytics is sent when the user has opt-out, calling posthog.identify trigger a request to the analytics server. We may consider this as a bug in the library itself, but in the mean time, this PR prevent calling posthog.identify is user consent is not set to true.

Motivation and context

Closes #8020

Screenshots / GIFs

Tests

  • Add a breakpoint to Posthog::identify and ensure that it's never called when analytics consent is not provided, for instance when the application is started.
  • Breakpoints can also be put in com.posthog.android.ConnectionFactory.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

…use it sends request `<server>/decide/?v=2` to the analytic server.
@bmarty bmarty added the Z-NextRelease For issues and PRs which should be included in the NextRelease. label Jan 30, 2023
@bmarty bmarty requested review from a team and yostyle and removed request for a team January 30, 2023 11:12
Copy link
Contributor

@yostyle yostyle left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

57.8% 57.8% Coverage
0.0% 0.0% Duplication

@bmarty bmarty merged commit 156f4f7 into develop Jan 30, 2023
@bmarty bmarty deleted the feature/bma/fixPosthog branch January 30, 2023 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-NextRelease For issues and PRs which should be included in the NextRelease.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ping to posthog.hss.element.io ??
2 participants