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

WPCOM API: Site Settings: Additional fields for Google Analytics D8279 #8198

Merged
merged 1 commit into from
Nov 27, 2017

Conversation

allendav
Copy link
Contributor

This commit syncs r165593-wpcom.
Related issue: #8181
Module change forthcoming in a separate PR: #8182

Changes proposed in this Pull Request:

  • Adds a 1.4 version of the site settings endpoint that allows new fields in the google analytics setting

Testing instructions:

Fire up postman
Set your headers to
Content-Type: application/json
Authorization: X-WPCOOKIE (steal a token from a developer REST API console request)
Origin: https://developer.wordpress.com
(you'll need to use Postman Interceptor to pull that off)

First, let's double check the 1.3 endpoint for regression

Direct a v1.3 GET request at /site/{siteID}/settings ( e.g. /sites/87832313/settings )
( i.e. public-api.wordpress.com/rest/v1.3/sites/87832313/settings )
Ensure you get a wga key in the response and that it has the following sub-keys
code, anonymize_ip, ec_track_purchases, and ec_track_add_to_cart

Direct a v1.3 POST request to /site/{siteID}/settings ( e.g. /sites/87832313/settings )
Set the body to something like

{
  "wga": {
	"code": "UA-12345678-4",
	"ec_track_add_to_cart": 1
   }
}

Note: For v1 compatibility, all requests must include the code field. All other fields are optional

Now, let's test the 1.4 endpoint.

Direct a v1.4 GET request at /site/{siteID}/settings ( e.g. /sites/87832313/settings )
( i.e. public-api.wordpress.com/rest/v1.4/sites/87832313/settings )
Ensure you get a wga key in the response and that it has the following sub-keys
code, anonymize_ip, ec_track_purchases, ec_track_add_to_cart, enh_ec_tracking,
enh_ec_track_remove_from_cart, enh_ec_track_prod_impression, enh_ec_track_prod_click,
enh_ec_track_prod_detail_view, enh_ec_track_checkout_started

Direct a v1.4 POST request to /site/{siteID}/settings ( e.g. /sites/87832313/settings )
Set the body to something like

{
  "wga": {
	"code": "UA-12345678-4",
	"ec_track_add_to_cart": 1,
	"enh_ec_tracking": 1,
	"enh_ec_track_checkout_started": 1
   }
}

Note: For v1 compatibility, all requests must include the code field. All other fields are optional

Try a few combinations to ensure it works well.

cc @justinshreve

@dereksmart dereksmart merged commit cf951b2 into master Nov 27, 2017
@dereksmart dereksmart deleted the sync/allendav/r165593-wpcom-1510872231 branch November 27, 2017 17:31
@dereksmart dereksmart removed the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label Nov 27, 2017
@oskosk oskosk added this to the 5.6 milestone Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants