Skip to content

Expose window.GoDAM.hasAttributionConsent - #2395

Merged
KMchaudhary merged 1 commit into
developfrom
fix/consent-declarations
Nov 19, 2026
Merged

KMchaudhary merged 1 commit into
developfrom
fix/consent-declarations

Conversation

@KMchaudhary

@KMchaudhary KMchaudhary commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Exposes window.GoDAM.hasAttributionConsent() from the GoDAM map tracker so other code can read whether the visitor has consented to attribution tracking.

The MAP tracker now publishes window.GoDAM.hasAttributionConsent() — the inverse of a page-wide Global Privacy Control opt-out. It is set on init(), before the connected-tool guard, so the value is available regardless of which analytics tool is connected.

Where it is readable: the tracker script is only enqueued where MAP tracking is on (tracking enabled with at least one provider) and a player was rendered. On every other page window.GoDAM.hasAttributionConsent is undefined — which itself means GoDAM will not attribute there. The helper reflects only the page-wide GPC opt-out, not the WP Consent API marketing decision.

Scope note

This PR was trimmed to only the hasAttributionConsent export. The consent-storage declarations (SESSIONSTORAGE/functional-category declarations in class-visitor-consent.php) are handled more completely in #2394, so they have been dropped from this branch to avoid duplication/conflicts.

Changes

  • assets/src/js/godam-player/map-tracking.js — expose window.GoDAM.hasAttributionConsent().
  • assets/src/js/godam-player/map-tracking.test.js — coverage for the exposed helper.

Testing

  • npx jest assets/src/js/godam-player/map-tracking.test.js — 43/43 pass.
  • npx eslint assets/src/js/godam-player/map-tracking.js — clean.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
15 0 15

⚠️ Warnings (15)

📁 readme.txt (2 warnings)
📍 Line 🔖 Check 💬 Message
0 mismatched_plugin_name Plugin name "GoDAM - Video Hosting for LMS & Online Courses" is different from the name declared in plugin header "GoDAM".
0 readme_parser_warnings_trimmed_section_description The "Description" section is too long and was truncated. A maximum of 2500 characters is supported.
📁 inc/classes/class-media-library-ajax.php (1 warning)
📍 Line 🔖 Check 💬 Message
1643 WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "max_srcset_image_width".
📁 assets/build/pages/video-editor.min.js (1 warning)
📍 Line 🔖 Check 💬 Message
2 react_removed_api This file calls "ReactDOM.findDOMNode", which was removed in React 19 and stops working once WordPress upgrades React. Use a ref on the element instead.
📁 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 (5 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/11/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.
📁 assets/build/js/main.min.js (5 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/11/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.

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@subodhr258 subodhr258 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at 933adbf4c. CI is green (JS and PHP unit tests, PHPCS, Plugin Check). I read the code but did not run it on a site.

Claim How checked Result
godamLayerInteractions lives in sessionStorage utils/storage.js and utils/consent.js both use sessionStorage Correct, SESSIONSTORAGE is right
The 4 new functional items exist and match their text NF / EVF / FF storeInLocalStorage() write { data, expiresAt: now + 10 min }; LifterLMS uses the godam_llms_video_progress_ prefix Correct
Every GoDAM browser item is now declared grepped every localStorage / sessionStorage use under assets/src Two are still missing, see the inline comments
window.GoDAM.hasAttributionConsent can be read whenever the script loads init() and Map_Tracker::maybe_enqueue_script() Correct, but the script only loads when MAP tracking is on and a player is on the page, see the inline comment
Existing window.GoDAM helpers are kept analytics-helpers.js also uses window.GoDAM = window.GoDAM || {} Fine, nothing gets overwritten

The inline comments are small additions; none of them blocks the PR.

Comment thread inc/classes/class-visitor-consent.php Outdated
'personal_data' => '',
),
array(
'name' => 'godam_llms_video_progress_*',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two more GoDAM items still aren't declared anywhere:

  1. uppyState:* (localStorage): godam-recorder/index.js loads Uppy's GoldenRetriever with expires: 10 * 60 * 1000. It saves the recorder state under uppyState:<id> keys, and the NF form and the recorder clear them on submit (key.startsWith( 'uppyState:' )). GoldenRetriever also puts a copy of the recorded file in IndexedDB. This is the same feature as the three *-recorder-data items, so it belongs here as a functional item.
  2. godam-map-session-<jobId> (sessionStorage): written by getSessionId() in map-tracking.js, and sent to the marketing tool with each milestone. It's tied to marketing attribution, so it should go under the marketing category rather than functional or statistics.

The other storage keys I found are already declared, or (godamPreviewDeviceView) only appear on the GoDAM preview page, not to site visitors.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Heads-up: this PR has been re-scoped to only the hasAttributionConsent export in map-tracking.js. The consent-declaration work in class-visitor-consent.php was dropped from this branch and is now handled in #2394, so this feedback applies there rather than here. Flagging it for that PR; not resolving this thread.

Comment thread inc/classes/class-visitor-consent.php Outdated
public static function get_functional_storage_items() {
return array(
array(
'name' => 'godam-nf-recorder-data',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

personal_data is empty for the three recorder items, but each one stores the URL of the video the visitor just recorded (@param {string} data File URL. in ninja-forms/index.js). A recording of someone's face and voice is personal data, so a banner should say so, for example __( 'Link to the video you recorded', 'godam' ).

Also a small one: the 10 minutes is only checked when the value is read. If the visitor never comes back to the form, the item stays in localStorage until it's next read. "Up to 10 minutes, cleared on submit or next visit" would be more accurate, but it's fine to leave as is.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Heads-up: this PR has been re-scoped to only the hasAttributionConsent export in map-tracking.js. The consent-declaration work in class-visitor-consent.php was dropped from this branch and is now handled in #2394, so this feedback applies there rather than here. Flagging it for that PR; not resolving this thread.

Marketing/attribution tools, Woo's consent module included, expose
nothing on window, so a site's banner or a tester could only infer
whether GoDAM would attribute a view by watching for the request. The
MAP tracker now publishes its own decision as
window.GoDAM.hasAttributionConsent(), the inverse of a page-wide Global
Privacy Control opt-out. It is set on init() before the connected-tool
guard, so it is readable whenever the tracker script loads.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@KMchaudhary
KMchaudhary force-pushed the fix/consent-declarations branch from 933adbf to d25f16b Compare November 19, 2026 10:40
@KMchaudhary KMchaudhary changed the title Declare functional browser storage, fix the layer-buffer type, and expose attribution consent Expose window.GoDAM.hasAttributionConsent Nov 19, 2026
@KMchaudhary
KMchaudhary merged commit cc7e546 into develop Nov 19, 2026
4 checks passed
@KMchaudhary
KMchaudhary deleted the fix/consent-declarations branch November 19, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants