-
Notifications
You must be signed in to change notification settings - Fork 315
Description
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
- Login to a site with Analytics and AdSense data
- Add www in the defined URLs under "Settings > General Settings" in a standard WordPress setup
- Login to your site once more and setup Site Kit
- 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
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.- The existing Analytics report endpoint dimension filter that filters by
ga:hostname
can be updated relying on theIN LIST
operator.
- The existing Analytics report endpoint dimension filter that filters by
- AdSense reports should request data for the current domain regardless of with or without
www.
prefix.- The existing AdSense report endpoint
filter
parameter can be updated with the necessaryOR
logic.
- The existing AdSense report endpoint
Implementation Brief
- Update the
Analytics::create_analytics_site_data_request
method:- Use the
IN_LIST
operator instead ofEXACT
for thega:hostname
dimension; - Update expressions for the same dimension to include the hostname with and without leading
www.
.
- Use the
- Update the
AdSense::create_adsense_earning_data_request
method to use the hostname for theDOMAIN_NAME
filter with and withoutwww.
.- Check the documentation on how to use a filter with
OR
logic: https://developers.google.com/adsense/management/reporting/filtering#OR
- Check the documentation on how to use a filter with
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.