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

Fix/ad tracking gdpr signup issue #29741

Merged
merged 1 commit into from
Jan 3, 2019
Merged

Conversation

MicBosi
Copy link
Contributor

@MicBosi MicBosi commented Dec 24, 2018

Changes proposed in this Pull Request

  • Fixes issue reported here pa0z1R-b9-p2/#comment-313

The issue: ad-tracking is blocked during signup for non-GDPR countries since country check relies on the user object which during signup is not available. So far this wasn't an issue because we weren't tracking signups but lately we have started doing so.

Instead we now request the current country code using a logic that is coherent with the A8C_Analytics plugin that runs on wordpress.com homepage and landing pages, by simply using the https://public-api.wordpress.com/geo/ API and storing it to the country_code cookie which is also used by A8C_Analytics. The cookie expires and it's refreshed every 6 hours.

Testing instructions

Test EU country:

  • Disable Automattic proxy (optional, makes Geo IP testing more straightforward when testing with your local IP)
  • Using a VPN service like TunneBear visit the following from a EU country
  • Open a new incognito window or clear all your cookies and localStorage
  • Make sure there is no country_code or sensitive_pixel_option cookies set
    visit the following address in Calypso, including flags required to enable ad-tracking:
/start/user/?flags=gdpr-banner,google-analytics,ad-tracking
  • Enable debug logs by entering the following in your browser console:
localStorage.setItem( 'debug', 'calypso:analytics:*' );
  • Make sure to delete any country_code cookie you might have
  • Refresh the page making sure the flags above are still present in the URL
  • In the console you should see the following:
isAdTrackingAllowed: false
  • Check you have a country_code cookie set to the country you are connecting from

Test non-EU country:

  • Clear all cookies or open a new incognito window.
  • Make sure there is no country_code or sensitive_pixel_option cookies set
  • Using a VPN service like TunneBear visit the following from the US or any non-EU country
  • Refresh the page making sure the flags above are still present in the URL
  • In the console you should see the following:
isAdTrackingAllowed: true
  • Check you have a country_code cookie set to the country you are connecting from

Test signup

  • While making sure you still get a isAdTrackingAllowed: true, visit /start/user/?flags=gdpr-banner,google-analytics,ad-tracking, signup and create a new free account while keeping Chrome's Dev Tools open.
  • Make sure "Preserve Log" is selected in the Network tab, else you'll lose the the logs once redirected to wordpress.com after signup completion.
  • Once completed the signup procedure you should see the two following pixels in the Network tab:
    • cab35a3a79dc4173b8ce2c47adad2cea: Icon Media retargeting pixel
    • d239e9cb6d164f7299d2dbf7298f930a: Icon Media signup pixel

Regressions:

  • While testing for the above make sure the various trackers fire as expected either using Ghostery (with ad blocking disabled) or looking in the Chrome's Network tab activity.

@matticbot
Copy link
Contributor

@MicBosi MicBosi added [Feature] Tracks Metrics & Monitoring Capturing analytics about user behavior on WordPress.com. [Status] In Progress labels Dec 24, 2018
@MicBosi MicBosi self-assigned this Dec 24, 2018
@MicBosi MicBosi force-pushed the fix/ad-tracking-gdpr-signup-issue branch from 6602151 to f505dd3 Compare December 24, 2018 15:25
@MicBosi MicBosi requested review from jaswrks and lsinger and removed request for jaswrks December 24, 2018 15:37
@MicBosi MicBosi force-pushed the fix/ad-tracking-gdpr-signup-issue branch 3 times, most recently from 85d260a to a3ce6b6 Compare December 27, 2018 15:09
@MicBosi MicBosi force-pushed the fix/ad-tracking-gdpr-signup-issue branch from 60f2355 to 68b30c8 Compare December 31, 2018 13:37
@MicBosi MicBosi added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Dec 31, 2018
Copy link
Contributor

@jaswrks jaswrks left a comment

Choose a reason for hiding this comment

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

LGTM! :) Behaves as expected when testing from various countries. All of the trackers are continuing to fire in Ghostery whenever I test from a non-EU country.

@jaswrks jaswrks added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 3, 2019
@jaswrks jaswrks merged commit dc65fc2 into master Jan 3, 2019
@jaswrks jaswrks deleted the fix/ad-tracking-gdpr-signup-issue branch January 3, 2019 10:42
@jaswrks
Copy link
Contributor

jaswrks commented Jan 3, 2019

I (@jaswrks) merged and deployed this on behalf of @MicBosi, who is AFK at this time.

blowery added a commit that referenced this pull request Jan 3, 2019
…sh-2019

* origin/master:
  Disable select when only one domain exiists (#29873)
  Tiled galleries: Disable captions (#29776)
  Prevent scrolling up when opening a dialog (#29832)
  Gutenberg: Move Shortlinks to production (#29883)
  Gutenlypso: add convert to blocks dialog (#29790)
  Gutenberg: Move Related Posts to production blocks (#29650)
  Analytics: fix ad-tracking issue on signup for non-gdpr countries (#29741)
  Update mobile phone validation module (used for 2fa) (#29740)
  Gutenlypso: make sure titles load on second edit (#29877)
  Site Picker: Change wording of /page and /block-editor to match /post (#29859)
  Gutenberg: update copy link in page list to be editor aware
  Gutenberg: use core approach of initialEdits over overridePost
  Gutenberg: when duplicating a post, override post content
  Gutenberg: update duplicate url when Gutenlypso is enabled
  Refactor: Replace use of key-mirror with inline code (#29857)
  Fixes wrong selected domain name (#29824)
  Turn off prettier for SASS, use stylelint instead (#29697)
  Gutenberg: Add copy button to Shortlinks (#29556)
  add a section name to the body class (#29563)
@MicBosi
Copy link
Contributor Author

MicBosi commented Jan 3, 2019

Thanks, @jaswrks! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Tracks Metrics & Monitoring Capturing analytics about user behavior on WordPress.com.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants