google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.23k stars 286 forks source link

Implement RRM `getServiceURL()` selector #8848

Closed nfmohit closed 2 months ago

nfmohit commented 3 months ago

Feature Description

The getServiceURL() selector should be implemented for the Reader Revenue Manager module that should return a prepared link to the Reader Revenue Manager platform that meets this criteria.


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

Acceptance criteria

Implementation Brief

Test Coverage

QA Brief

  1. Activate the Reader Revenue Manager module.
  2. Run following command in browser console.
    googlesitekit.data.select('modules/reader-revenue-manager').getServiceURL( { publicationID: 'ABCDEFGH' } );

You must get the URL like following

https://accounts.google.com/accountchooser?continue=https://publishercenter.google.com/reader-revenue-manager?publication=ABCDEFGH&utm_source=sitekit&Email=your-email@get10up.com

Notice that email will be replaced with your account email.

  1. Clicking on the above link should take you to the publisher center, but page will open in publisher center only if the publication ID is valid (in this case ABCDEFGH which is invalid). You can create a publication in https://publishercenter.google.com/ to get the publication ID.

  2. Again, in the browser console, run the following script:

googlesitekit.data.select( 'modules/reader-revenue-manager' ).getServiceURL()
  1. The link that will receive should take you to the publisher center homepage, i.e. https://publishercenter.google.com/

Changelog entry

nfmohit commented 3 months ago
  • Create a new store definition in assets/js/modules/analytics-4/datastore/service.js.

Hi @techanvil, just to confirm, shouldn't this be assets/js/modules/reader-revenue-manager/datastore/service.js instead?

techanvil commented 3 months ago

Thanks @nfmohit, apologies for the copy/paste fail! This is now fixed, cheers.

nfmohit commented 3 months ago

Brilliant, thanks @techanvil! IB ✅

ankitrox commented 3 months ago

I've created the PR: https://github.com/google/site-kit-wp/pull/8953 for this issue, but keeping this issue in Execution because its dependencies #8786 is yet to be merged.

Once merged, the base branch for this PR needs to be changed to develop and test everything and move this to CR.

kelvinballoo commented 2 months ago

QA Update ⚠️

I did some tests and results and queries are as follows:

ankitrox commented 2 months ago

Hi @kelvinballoo ,

Thank you for testing this issue.

Only getserviceURL() - While the link goes to the Publisher central page initially, it goes directly to the publication afterwards. ⚠️ Refer to the attached video :

the publication ID query parameter is added by publisher centre automatically and we do not have the control over it. As you demonstrated in your video, even if we simply visit https://publishercenter.google.com/, that query parameter is getting appended in the URL.

It's worth noting that the URLs have a lot of symbols with %, etc.. In the AC, there is no mention of those symbols and add ons. The link works but are we expecting these? ⚠️

This is fine as the getServiceURL selector will encode the URL so that all the parameters and values can be passed safely.

kelvinballoo commented 2 months ago

QA Update ✅

Thanks for the update @ankitrox

Moving this ticket to approval.

Screenshot 2024-07-15 at 19 58 55