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

Add integration with WP Consent API #2425

Merged
merged 5 commits into from
Jun 18, 2024

Conversation

martynmjones
Copy link
Contributor

@martynmjones martynmjones commented Jun 7, 2024

Changes proposed in this Pull Request:

Adds integration with the WP Consent API plugin to better support different consent banner configurations.

If the plugin is installed on a website then the existing consent state will be sent as an update when tracking is initialised. For on-page updates, we're adding an event listener for wp_listen_for_consent_change which is dispatched by WP Consent API when any changes are made.

Detailed test instructions:

General test instruction

  1. Build extension from add/2387-wp-consent-api-integration
  2. Install Complianz and setup a basic consent banner
  3. Debug the site using Tag Assistant while logged out
  4. Grant consent via consent banner
  5. Confirm a Consent event is sent with the updated state
  6. Trigger GLA tracking events on page
  7. Confirm the events are all recorded in Tag Assistant and that the consent On-page Update is Granted (Under the Consent tab)
    Screenshot 2024-05-20 at 17 50 37
  8. Revoke consent via the consent banner
  9. Confirm that the consent state is no longer Granted in Tag Assistant

Additional details:

Copied and modified slightly from woocommerce/woocommerce-google-analytics-integration#425

Changelog entry

Add - Integration with the WP Consent API plugin

@martynmjones martynmjones self-assigned this Jun 7, 2024
@github-actions github-actions bot added type: enhancement The issue is a request for an enhancement. changelog: add A new feature, function, or functionality was added. labels Jun 7, 2024
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.

Project coverage is 64.3%. Comparing base (340cb89) to head (210333d).
Report is 17 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             develop   #2425      +/-   ##
============================================
+ Coverage       63.4%   64.3%    +0.9%     
- Complexity         0    4281    +4281     
============================================
  Files            321     780     +459     
  Lines           5027   21910   +16883     
  Branches        1218    1218              
============================================
+ Hits            3188   14097   +10909     
- Misses          1672    7646    +5974     
  Partials         167     167              
Flag Coverage Δ
js-unit-tests 63.4% <ø> (ø)
php-unit-tests 64.6% <0.0%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/Google/GlobalSiteTag.php 0.0% <0.0%> (ø)

... and 458 files with indirect coverage changes

@tomalec
Copy link
Member

tomalec commented Jun 16, 2024

Thanks for implementing it @martynmjones .

I tested it with Complianz and GDPR Cookie Compliance :)

I'm not sure if you already worked on it, but to save some time, I made a branch with E2E tests moved from GA4W
https://github.com/woocommerce/google-listings-and-ads/compare/add/2387-wp-consent-api-integration...dev/add-consent-tests?expand=1

@tomalec
Copy link
Member

tomalec commented Jun 16, 2024

also added some docs notes https://github.com/woocommerce/google-listings-and-ads/compare/add/2387-wp-consent-api-integration...tweak/add-consent-api-docs?expand=1

Feel free to merge those PRs or disregard them if you have a better implementation.

@tomalec
Copy link
Member

tomalec commented Jun 16, 2024

I also made changes to the public-faceing docs as for GA4W.

Add E2E tests for WP Consent API integration
@martynmjones
Copy link
Contributor Author

Hey @tomalec, many thank for adding the tests and docs 🙌 I've merged your branch into this one.

I tested it with Complianz and GDPR Cookie Compliance :)

Thanks for testing! I've not made further changes but have published the PR properly and requested a review to confirm were good to merge into develop.

@martynmjones martynmjones marked this pull request as ready for review June 17, 2024 16:48
Copy link
Member

@tomalec tomalec left a comment

Choose a reason for hiding this comment

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

Reviewed the code, tested locally with Complianz and GDPR Cookie Compliance, LGTM :)

@martynmjones martynmjones merged commit b86e92b into develop Jun 18, 2024
15 checks passed
@martynmjones martynmjones deleted the add/2387-wp-consent-api-integration branch June 18, 2024 11:10
@ianlin ianlin mentioned this pull request Jun 25, 2024
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: add A new feature, function, or functionality was added. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants