This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 832
Add support for Posthog Analytics under a labs flag #6495
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Make it an error to call it before its initialised, and separately track whether its been enabled * Use anonmity enum in the public interface * Properly await upstream calls * Fix accidental test fixture cross-reliance
* Redact and pass the redacted url as a property. redactedCurrentLocation might have issues with concurrent events * Remove DNT code and rely on posthog
We'd like to manually review each posthog change to avoid unanticipated tracking leakages; each upgrade should include reviewing the data coming in on events
IEvent.properties is a placeholder that needs to be overriden by extenders for type validation to take place. IWelcomeScreenLoad should have had properties declared for it. Because it didn't, a faulty call using it was possible.
…finition file Posthog's type definitions refer to types in transitive dependencies we don't want to include. Clone posthog.d.ts locally, remove the offending types from it, and provide an overriding mapping in tsconfig. If this proves annoying to maintain, posthog.d.ts could just be an empty file.
t3chguy
reviewed
Jul 28, 2021
jryans
reviewed
Aug 2, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code wise it looks reasonable to me, but I'm a bit unsure on how the opt-in/out behaviour is meant to work.
Co-authored-by: J. Ryan Stinnett <jryans@gmail.com>
jryans
approved these changes
Aug 2, 2021
This was referenced Aug 3, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
element-hq/element-web#18063
Add experimental support for Posthog analytics. The aim of these analytics is to understand better how people are using Element Web to improve the overall user experience; Element would self-host its own Posthog instance.
We are trialling the use of Posthog as a replacement for Matomo. This integration supersedes a previous experiment with Count.ly (#5365) which was unsuccessful. Count.ly and Matomo code will be removed in follow up PRs if we move forward with Posthog.
Support is activated via a labs flag
feature_pseudonymousAnalyticsOptIn
. Configuration is via new config keysposthog.projectApiKey
andposthog.apiHost
which are passed toposthog.init
.See comments in PosthogAnalytics.js for anonymity behaviour.
To roll out support for this approach, we will need to re-prompt users to opt in to Posthog tracking, as the tracking is slightly different to previously - we will be asking to pseudonymise matrix identifiers rather than redacting them completely.
(This went down a few rabbit holes, so apologies, not a lot of value in going through individual commits!)