Sponsored Content
The Wayback Machine - https://web.archive.org/web/20210817024824/https://github.com/google/site-kit-wp/issues/989
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

Update Site Kit version identification in Google Client requests #989

Closed
aaemnnosttv opened this issue Dec 19, 2019 · 6 comments
Closed

Update Site Kit version identification in Google Client requests #989

aaemnnosttv opened this issue Dec 19, 2019 · 6 comments

Comments

@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented Dec 19, 2019 •

Feature Description

Currently Site Kit passes the plugin version along in the query string for all proxy setup URLs. This is unnecessary now that feature support is explicitly declared in the supports parameter, which is preferred over inferring support from the version on the proxy. However, the Site Kit version is still valuable information statistically and should be kept.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The Site Kit version should not be sent as a query parameter in any proxy URL.
  • Platform and version should be sent in the user agent.

Implementation Brief

  • Remove version from OAuth_Client::get_proxy_setup_url
  • Add the Site Kit version to the user-agent header sent with all Google Client requests by setting the Application Name
    diff --git a/includes/Core/Authentication/Clients/OAuth_Client.php b/includes/Core/Authentication/Clients/OAuth_Client.php
    index 0ffed71d..4eafdef9 100644
    --- a/includes/Core/Authentication/Clients/OAuth_Client.php
    +++ b/includes/Core/Authentication/Clients/OAuth_Client.php
    @@ -189,6 +189,9 @@ final class OAuth_Client {
            } else {
                $this->google_client = new Google_Client();
            }
    +       $this->google_client->setApplicationName(
    +           sprintf( 'wordpress/google-site-kit/%s', GOOGLESITEKIT_VERSION )
    +       );
     
            // Return unconfigured client if credentials not yet set.
            $client_credentials = $this->get_client_credentials();
    

Application name using lowercase for consistency with the default user agent suffix

Changelog entry

  • Include platform and plugin version information in API client requests.
@felixarntz
Copy link
Member

@felixarntz felixarntz commented Dec 19, 2019

@aaemnnosttv The user agent should also include a platform-specific identifier: How about WordPress/GoogleSiteKit/$version?

@aaemnnosttv
Copy link
Collaborator Author

@aaemnnosttv aaemnnosttv commented Dec 19, 2019

Sure that sounds good to me, IB updated!

@felixarntz
Copy link
Member

@felixarntz felixarntz commented Dec 19, 2019

IB ✅

@felixarntz felixarntz removed their assignment Dec 19, 2019
@aaemnnosttv aaemnnosttv self-assigned this Jan 2, 2020
@aaemnnosttv
Copy link
Collaborator Author

@aaemnnosttv aaemnnosttv commented Jan 2, 2020

@felixarntz I'm wondering if maybe we should keep the version parameter in the setup URLs for statistics/support. The added configuration only affects API requests by the Google Client, but if users have a problem during the initial set up, they may never get to that point. Basically, since the proxy set up is a critical first step, it might be worth keeping that parameter.

Thoughts?

@felixarntz
Copy link
Member

@felixarntz felixarntz commented Jan 2, 2020 •

@aaemnnosttv I noticed that a few days ago too, but I generally think it's cleaner to remove it, as we want to know how the version distribution is overall. It would be useful for support as well, but I think in that case it's still rather trivial to ask the reporter of an issue which version they're using.

If we kept it, then we would also need to add platform for consistency, and I'd rather not do that.

@aaemnnosttv aaemnnosttv added this to the 1.1.5 milestone Jan 3, 2020
@aaemnnosttv aaemnnosttv assigned felixarntz and unassigned aaemnnosttv Jan 3, 2020
@felixarntz felixarntz assigned aaemnnosttv and unassigned felixarntz Jan 3, 2020
@aaemnnosttv aaemnnosttv assigned felixarntz and unassigned aaemnnosttv Jan 3, 2020
@felixarntz felixarntz removed their assignment Jan 5, 2020
@cole10up cole10up self-assigned this Jan 6, 2020
@cole10up
Copy link
Collaborator

@cole10up cole10up commented Jan 8, 2020

I ran through a set of regression around proxy setup, initial install, reinstall, reset. Everything functions properly. Version number exists and is passed through.

image

Passed QA ✅

@cole10up cole10up removed their assignment Jan 8, 2020
@felixarntz felixarntz closed this Jan 15, 2020
@ThierryA ThierryA removed this from the 1.2.0 milestone Feb 3, 2020
@ThierryA ThierryA added this to the Sprint 14 milestone Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants