Skip to content

Declare every GoDAM browser item correctly to the WP Consent API - #2394

Merged
rudrakshi-gupta merged 11 commits into
developfrom
fix/consent-storage-declarations
Nov 19, 2026
Merged

rudrakshi-gupta merged 11 commits into
developfrom
fix/consent-storage-declarations

Conversation

@rudrakshi-gupta

@rudrakshi-gupta rudrakshi-gupta commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

What and why

Three small 2.11.0 QA fixes, for release ticket rtCamp/godam-plugin-wp#112, from QA's pre-release review (items 3, 4 and 5), plus the points from code review. All are about what GoDAM tells the WP Consent API it keeps in the visitor's browser, which consent banners show in their cookie tables.

Wrong storage type (item 3). Every item was declared as LOCALSTORAGE, but godamLayerInteractions lives in session storage (utils/storage.js). Each item now names its own type and category, the way GoDAM for Woo 2.5.1 already does.

Undeclared functional items (item 5). The Fluent Forms, Ninja Forms and Everest Forms recorder links (godam-*-recorder-data), the recorder's Uppy state (uppyState:*) and its IndexedDB store (uppy-blobs), and LifterLMS video progress (godam_llms_video_progress_*) were never declared. They are now listed as functional, and the recorder items say they hold the visitor's unsent recording.

Marketo/HubSpot session (item 4). godam-map-session-<jobId> is declared as marketing, and map-tracking.js now honours that: with the WP Consent API active, no view is sent and no session is written until the visitor accepts marketing. The suggested privacy text gets a paragraph for sites connected to Marketo or HubSpot.

Where to look

Per-item type and category (inc/classes/class-visitor-consent.php, get_storage_items() and register_cookie_info())

foreach ( self::get_storage_items() as $item ) {
	wp_add_cookie_info( $item['name'], 'GoDAM', $item['category'], …, $item['type'] );
}

Check: the three analytics items keep statistics; only godamLayerInteractions changes type, to SESSIONSTORAGE.

Open question for review: the WP Consent API documents $type as one of HTTP, LOCALSTORAGE or API, and stores any other value as given. This PR uses SESSIONSTORAGE (as GoDAM for Woo 2.5.1 does) and INDEXEDDB, so banners show where each item really lives. If we'd rather stay inside the documented values, both become LOCALSTORAGE and the expiry text carries the difference.

Marketing consent gate (assets/src/js/godam-player/map-tracking.js, marketingConsentWithheld() and collectVisitorIds())

if ( privacyOptedOut() || marketingConsentWithheld() ) {
	return ids;
}

Check: with no ids, report() neither mints the session ID nor sends. It's read on every milestone, so accepting marketing mid-view carries the rest of the view. Without the WP Consent API nothing changes.

Privacy policy text (get_privacy_policy_content())

Check: the item list still holds only the three analytics items, since it says they wait for statistics consent. A new paragraph, marked "Only if GoDAM is connected to Marketo or HubSpot", covers the Marketo/HubSpot flow.

Everything else is mechanical: the new items' descriptions and the updated tests. The POT isn't regenerated here; it's done on the PR into main.

UI evidence

No visible change in GoDAM. With the WP Consent API and a supporting banner, the banner's cookie table lists 10 GoDAM items with their real category and type. I couldn't take screenshots because the local site wasn't running when this PR was raised.

How to test

  1. With the WP Consent API active, check wp_get_cookie_info() (or the banner's cookie list): 10 GoDAM items, with the categories and types in get_storage_items().
  2. Under Settings > Privacy > Policy Guide, the GoDAM text lists the three analytics items, then the Marketo/HubSpot paragraph.
  3. On a site connected to Marketo or HubSpot, with a WP Consent API banner: before accepting marketing, play a video. No request goes to godam/v1/map-events and no godam-map-session-* is in session storage. Accept marketing and keep watching: milestones are sent.

VisitorConsentTest passes (13 tests, 65 assertions), the godam-player JS tests pass (562), and PHPCS is clean.

Risk

risk: low: the declarations change what banners show, and the one behaviour change only stops Marketo/HubSpot milestones for visitors who haven't accepted marketing on a WP Consent API site.

- Each item in get_storage_items() now names its category and type, the
  way GoDAM for Woo does.
- godamLayerInteractions is declared as SESSIONSTORAGE: utils/storage.js
  keeps the layer buffer per tab. It was declared as LOCALSTORAGE, so
  consent banners listed it wrongly.
- The test checks the type of each item.
- The Fluent Forms, Ninja Forms and Everest Forms recorder links
  (godam-*-recorder-data), the recorder's upload state (uppyState:*) and
  LifterLMS video progress (godam_llms_video_progress_*) were kept in
  local storage but never declared. They are now listed as functional.
- The suggested privacy policy text stays about analytics: it lists only
  the statistics items, since it says those wait for consent.
- map-tracking.js keeps godam-map-session-<jobId> in session storage to
  group one view's milestones. It was never declared; it is now listed
  as marketing, since it only runs with a connected Marketo or HubSpot
  account.
- This only declares it. Gating the script on Track visitors and consent
  is left for a follow-up.
@rudrakshi-gupta rudrakshi-gupta added the risk: low QA automation only (Dependabot fixes, copy, CSS) label Nov 19, 2026
@github-actions

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/hello-world/ (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/sample-page/ (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/hello-world/ (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/sample-page/ (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

It goes straight into the 2.11.0 release, after the version bump.
@KMchaudhary

Copy link
Copy Markdown
Collaborator

Code review — consent declarations

High-effort pass over the diff (class-visitor-consent.php, VisitorConsentTest.php, languages/godam.pot). Six points, most-important first.

1. godam-map-session-* is declared marketing but the write isn't gated on marketing consent

inc/classes/class-visitor-consent.php:256

The item is declared under marketing, but assets/src/js/godam-player/map-tracking.js writes godam-map-session-<jobId> and posts the view to Marketo/HubSpot checking only Global Privacy Control and HubSpot's own opt-out — never wp_has_consent( 'marketing' ). On a WP-Consent-API site, a visitor who declines marketing still gets the session written and the view sent, while the banner (trusting this declaration) tells them it's gated. Either gate the write on marketing consent, or document why it's exempt.

2. languages/godam.pot regenerated on a develop-bound PR

languages/godam.pot:1

Recent feature PRs (#2251, #2376) explicitly leave the POT out — "it is regenerated on the PR into main." Regenerating it here conflicts with every other in-flight branch that also regenerated it (each run embeds different build references), so it'll need reverting before merge. Suggest dropping the POT change.

3. Suggested privacy-policy text omits the marketing (Marketo/HubSpot) flow

inc/classes/class-visitor-consent.php:306

get_privacy_policy_content() skips every non-statistics item, so the suggested text never mentions that watch data is sent to the site's Marketo/HubSpot — even though this PR now classifies godam-map-session as marketing tracking. A site owner pasting it publishes an incomplete disclosure. Consider a short marketing paragraph, or a note that it's disclosed elsewhere.

4. Test no longer catches a duplicate registration or wrong count

tests/php/VisitorConsentTest.php:101

$items is keyed by cookie name, so a double-registration (or an extra item reusing a name) collapses to one key and the assertSame against the 9-entry map still passes. The old test asserted the exact ordered list. An assertCount on $GLOBALS['rtgodam_cookie_info'] would restore that guard.

5. GoldenRetriever's IndexedDB file store is undeclared

inc/classes/class-visitor-consent.php:239

uppyState:* (localStorage) is declared, but GoldenRetriever ({ expires: 10*60*1000 }) also persists the actual recording bytes in IndexedDB. Only the localStorage key is listed, so the cookie table omits the store holding the visitor's media. Worth confirming whether the IndexedDB store should be declared too.

6. personal_data is empty for the recorder-data items

inc/classes/class-visitor-consent.php:215

godam-ff/nf/evf-recorder-data hold a link to the visitor's own recording, but personal_data is '', so a banner reports "no personal data." A short label (e.g. "Link to your unsent recording") would make the cookie table accurate.


🤖 Automated review via Claude Code. #1–#3 are worth a look before merge; #4–#6 are minor.

- With the WP Consent API active, collectVisitorIds() returns nothing
  until wp_has_consent( 'marketing' ) is true, so no view is sent and no
  godam-map-session-* is written for a visitor who hasn't accepted
  marketing. It's read on every milestone, so accepting mid-view still
  carries the rest of the view.
- Without the WP Consent API nothing changes.
- This matches the item's declaration as marketing (review point 1).
- The suggested text listed only the analytics items, so a site sending
  video views to Marketo or HubSpot published an incomplete disclosure.
- It now has a paragraph, marked for sites connected to Marketo or
  HubSpot, that says what is sent, names godam-map-session-<video> and
  says it waits for marketing consent (review point 3).
The test keyed the calls by name, so a name registered twice would still
pass. It now checks the number of calls too (review point 4).
Uppy's Golden Retriever keeps the recording itself in the uppy-blobs
IndexedDB database for 10 minutes, next to the uppyState:* key. It is
now declared as functional, with type INDEXEDDB (review point 5).
The recorder items had no personal data label, so consent banners said
they held none. The form recorder links, the Uppy state and the IndexedDB
store now say they hold the visitor's unsent recording (review point 6).
Develop-bound PRs don't regenerate languages/godam.pot: it conflicts with
other branches, and the POT check only runs on PRs into main. This
reverts 6cabe04 (review point 2).
@rudrakshi-gupta

Copy link
Copy Markdown
Member Author

Thanks @KMchaudhary, all six addressed, one commit each:

  1. Marketing gate: 747d10c. With the WP Consent API active, collectVisitorIds() returns nothing until wp_has_consent( 'marketing' ) is true, so no milestone is sent and no godam-map-session-* is written. It's read on every milestone, so accepting mid-view still carries the rest of the view. Without the API nothing changes.
    1. POT: 29d4d38 reverts it. It's regenerated on the PR into main.
    1. Privacy text: 40de43b adds a paragraph, marked for sites connected to Marketo or HubSpot, that says what is sent, names godam-map-session-<video> and says it waits for marketing consent.
    1. Test: 6569798 adds assertCount on the calls.
    1. IndexedDB: e91c960 declares uppy-blobs (functional, 10 minutes).
    1. personal_data: 5da2571 labels the recorder links, uppyState:* and uppy-blobs.
      One question back: the WP Consent API documents $type as HTTP, LOCALSTORAGE or API only, and stores anything else as given. This PR uses SESSIONSTORAGE (as Woo 2.5.1 does) and INDEXEDDB so banners show where each item really lives. OK to keep, or would you rather stay with LOCALSTORAGE and let the expiry text carry the difference?

@rudrakshi-gupta
rudrakshi-gupta merged commit 63b35d8 into develop Nov 19, 2026
5 checks passed
@rudrakshi-gupta
rudrakshi-gupta deleted the fix/consent-storage-declarations branch November 19, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low QA automation only (Dependabot fixes, copy, CSS)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants