这是indexloc提供的服务,不要输入任何密码
Skip to content

Ensure adding a www prefix doesn't result in reporting of Analytics and AdSense from that date only (or vice versa) #3005

@jamesozzie

Description

@jamesozzie

Bug Description

As raised in the WordPress support forums at present when a user adds www to their site URL they're then prompted to setup Site Kit once more, with the plugin identifying this new URL.

With any such www prefix modifications Site Kit should maintain the same Analytics or AdSense data, and not populate dashboards or display data based only on this new URL.

Steps to reproduce

  1. Login to a site with Analytics and AdSense data
  2. Add www in the defined URLs under "Settings > General Settings" in a standard WordPress setup
  3. Login to your site once more and setup Site Kit
  4. Wait for data to appear - the services will already be connected, but the dashboards and data that are populated will be based on the www version of your site only, with no legacy information from before the www change.

Screenshots

image

Additional Context

  • Tested and reproduced in support, Site Kit version 1.28.0
  • A filter was introduced recently for reporting on a WordPress specific install only, with some sites using WordPress within a subdirectory of a primary non WordPress domain

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

Acceptance criteria

  • Analytics reports should request data for the current domain regardless of with or without www. prefix.
  • AdSense reports should request data for the current domain regardless of with or without www. prefix.

Implementation Brief

  • Update the Analytics::create_analytics_site_data_request method:
    • Use the IN_LIST operator instead of EXACT for the ga:hostname dimension;
    • Update expressions for the same dimension to include the hostname with and without leading www..
  • Update the AdSense::create_adsense_earning_data_request method to use the hostname for the DOMAIN_NAME filter with and without www..

Test Coverage

  • Update existing tests if any is broken due to the aforementioned changes.

Visual Regression Changes

  • N/A

QA Brief

This brief is based on testing from a local environment. If testing on a published website edit the site URL in Settings -> General Settings as usual and add/remove the www. prefix.

  • Reset Site Kit

  • Use Site Kit developer settings plugin to set the custom site url to https://www.elasticpress.io

  • Setup Site Kit

  • Connect Analytics

  • Connect Adsense

  • Check Analytics page data Site Kit -> Analytics and note the four main values as per the screenshots in the issue description

  • Check Adsense page data Site Kit -> Adsense and note the four main values

  • Reset Site Kit

  • Use Site Kit developer settings plugin to set the custom site url to https://elasticpress.io

  • Setup Site Kit

  • Connect Analytics

  • Connect Adsense

  • Check Analytics page data again and that they match the noted values

  • Check Adsense page data again and that they match the noted values

Changelog entry

  • Ensure changing the site URL between HTTP and HTTPS or www. and non-www. does not impact the results displayed in Analytics and AdSense widgets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Module: AdSenseGoogle AdSense module related issuesModule: AnalyticsGoogle Analytics module related issuesP0High priorityType: BugSomething isn't workingType: SupportSupport request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions