Include a "request access" link to Analytics when a user encounters an "Insufficient Permissions" notice
See original GitHub issueBug Description
When an admin sets up Site Kit and they don’t have access to the already connected Analytics property, which was connected by another admin, they encounter an insufficient permissions notice. Consider adding a link to that specific Google Analytics property page, so users can “request access”. That way they don’t need to specifically know the administrator in question, as the username doesn’t always appear within the error.
Note that this link already exists within the Site Kit dashboard, but only under the “Top content over the last ** days” widget, see example in the video within this issue:

The link should look something like this, including the users email and property details:
https://analytics.google.com/analytics/web/?authuser=**emailhandle**%40gmail.com#/report/content-pages/a145833174w302476565p260252701/_u.date00=20220503&_u.date01=20220530/
Steps to reproduce
- Set up Site Kit while also connecting Analytics
- Login as another wp-admin user that doesn’t have access to the connected GA property
- Set up Site Kit
- You’ll see the “Insufficient permissions” notice
- Only by clicking on the Analytics link in the lower Analytics widget (Top content over the last 28 days) will you be directed to a link where you can “request access”
Additional Context
Should this be added it would solve the problem as described in https://github.com/google/site-kit-wp/issues/5267
A possible fix to this would be to change the text to the below:
- Your Google account does not have sufficient permissions to access Analytics data, so you won’t be able to see stats from it on the Site Kit dashboard. This service was originally connected by the administrator "****" — you can contact them for more information..
+ Your Google account does not have sufficient permissions to access Analytics data, so you won’t be able to see stats from it on the Site Kit dashboard. This service was originally connected by the administrator "****" — you can contact them for more information, or **request access here**.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- All JS stores for modules where the Google service allows requesting access for an entity where the account does not have access currently, should receive a new selector consistently named
getServiceEntityAccessURL(parameter-less). These are:- Analytics: Should basically return the same as
getServiceReportURLselector withtypeset toreport-home. - Search Console: Should return the same as
getServiceURLselector with a single query argumentresource_idset to the current Search Console property ID. - All other Google services do not have any UI that would inform about how to get access.
- Analytics: Should basically return the same as
- Any “insufficient permissions” error message (for any module/service) should be conditionally enhanced as follows:
- If the module’s data store includes a
getServiceEntityAccessURLselector, a primary CTA button with label “Request access” should be shown below the error message that links to the service URL (i.e. the plain service URL from the selector).- From there, the respective Google service will show corresponding UI for what the end user can do to get access.
- The button should look similarly to the retry button (conditionally added to other types of errors) from #5236.
- If the module’s data store includes a
- A Storybook story for one of these errors should be added, alongside the existing story for the retry button (see #5236).
Implementation Brief
- Within
/assets/js/modules/analytics/datastore/service.jsand/assets/js/modules/search-console/datastore/service.js:- Create a new
getServiceEntityAccessURLselector usingcreateRegistrySelector(). Define the new selector as per the AC.
- Create a new
- Within
ReportError:- Use the
getModuleStoreNameselector from theCORE_MODULESstore. - Call the new
getServiceEntityAccessURLselector on the module’s store only if the function exists, e.g.typeof select( moduleStoreName ).getServiceEntityAccessURL === 'function'. - If the selector returns a value and if one of the
errorsis an “Insufficient Permissions Error” (use the selectorisInsufficientPermissionsError), then return a<Button>with the labelRequest accesssimilar to how the Retry button is being added currently.
- Use the
- Modify the existing “ReportError with Insufficient Permissions” story mocking the data of a module which has the
getServiceEntityAccessURLselector.
Test Coverage
- Add tests for the new selectors.
QA Brief
- Follow the steps in the description to reproduce the issue.
- Ensure the
Request accessbutton with the URL is rendered for Analytics and Search Console insufficient permission errors. - Click the
Request accessbutton from the Analytics and Search Console and ensure they navigate to the right place to request access. - For CR, ensure this new story is as expected.
- For QA, ensure this new story is as expected.
Follow-up PR Update
- Ensure the
Request accessbutton and theGet helplink are aligned vertically, as pointed out in this comment.

Changelog entry
- Add “Request access” button to permission error messages for modules where their service supports it.
Issue Analytics
- State:
- Created a year ago
- Comments:13 (4 by maintainers)

Top Related StackOverflow Question
@aaemnnosttv SGTM, I’ve updated the ACs accordingly. I shortened it a bit to just
getServiceEntityAccessURLthough. Note that this is actually only relevant for Analytics and Search Console, so with the new selector that part is also improved and we don’t unnecessarily add these buttons for services where it doesn’t make sense.@jimmymadon @techanvil This should be ready to iterate on the IB based on the updated ACs. Of course due to the new first point, the estimate is likely to increase a little.
QA Update: ✅
Apologies, I should have picked up on this! I can confirm that the ‘Get Help’ text is aligned to the request access text.