Hotfix: Disable PostHog automatic data collection#1747
Open
subodhr258 wants to merge 1 commit intomainfrom
Open
Hotfix: Disable PostHog automatic data collection#1747subodhr258 wants to merge 1 commit intomainfrom
subodhr258 wants to merge 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates PostHog initialization and consent handling to prevent tracking from being enabled by default, and to avoid re-enabling tracking after a prior opt-out during API key activation/verification.
Changes:
- Tightens PostHog enablement in JS to require an explicit
enabledopt-in value (1/'1'). - Adjusts API key verification flow to only auto-enable PostHog when no prior consent state has been recorded (
posthog_initializedempty).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
pages/utils/posthog.js |
Requires explicit opt-in (enabled === 1 / '1') before initializing PostHog. |
admin/godam-transcoder-functions.php |
Avoids re-enabling tracking after opt-out; still auto-enables when no consent state exists. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+515
to
521
| // Auto-enable PostHog tracking only when the user has never made a consent choice. | ||
| // If posthog_initialized is already true the user has either opted in or explicitly opted out — respect that decision. | ||
| $settings = get_option( 'rtgodam-settings', array() ); | ||
| if ( $save || empty( $settings['general']['posthog_initialized'] ) ) { | ||
| if ( empty( $settings['general']['posthog_initialized'] ) ) { | ||
| $settings['general']['enable_posthog_tracking'] = true; | ||
| $settings['general']['posthog_initialized'] = true; | ||
| update_option( 'rtgodam-settings', $settings ); |
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
missing_composer_json_file | The "/vendor" directory using composer exists, but "composer.json" file is missing. |
📁 readme.txt (2 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
mismatched_plugin_name | Plugin name "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" is different from the name declared in plugin header "GoDAM". |
0 |
trademarked_term | The plugin name includes a restricted term. Your chosen plugin name - "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" - contains the restricted term "wordpress" which cannot be used at all in your plugin name. |
📁 assets/build/css/main.css (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedStylesScope | This style is being loaded in all contexts. |
📁 assets/src/libs/analytics.min.js (6 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/03/19/demo-post-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-page-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/?godam-video=demo-godam-video-post (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
📁 assets/build/js/main.min.js (6 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/03/19/demo-post-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-page-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/?godam-video=demo-godam-video-post (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue - https://github.com/rtCamp/godam-core/issues/936
This pull request updates how PostHog tracking is enabled in the application, ensuring that user consent is always respected and tracking is only enabled when the user has explicitly opted in. The changes prevent automatic enabling of tracking in scenarios where the user has not made a clear choice.
Consent and tracking logic improvements:
admin/godam-transcoder-functions.php, PostHog tracking is now auto-enabled only if the user has never made a consent choice (posthog_initializedis empty), and will not be re-enabled automatically if the user previously opted out—even when activating an API key. This ensures user consent is respected.pages/utils/posthog.js, PostHog tracking is now enabled only when the configuration explicitly indicates an opt-in (enabled === '1'orenabled === 1), preventing tracking from being enabled by default.Recordings
Before
PostHog.before.mov
After
PostHog.after.mov