Create REST Endpoint GET:adsense-links
for Analytics_4
module
#8046
Labels
Module: AdSense
Google AdSense module related issues
Module: Analytics
Google Analytics module related issues
P1
Medium priority
PHP
Type: Enhancement
Improvement of an existing feature
Feature Description
Using the code added in #8045, we need to create a REST Route in our WordPress REST API Routes in the Analytics module for fetching AdSense accounts linked to Analytics accounts from the Google Analytics API.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
GET:adsense-links
should be added to theAnalytics_4
module.Google_Service_GoogleAnalyticsAdmin_GoogleAnalyticsAdminV1alphaAdSenseLink[]
Implementation Brief
Google\Site_Kit\Modules\Analytics_4\GoogleAnalyticsAdmin\PropertiesAdSenseLinksService
and a service (TBD. ie.analyticsadsenselinks
).Google\Site_Kit\Modules\Analytics_4
class:get_datapoint_definitions()
method, addGET:adsense-links
datapoint with the aforementioned service.create_data_request()
method, add a case for the above datapoint:$data['propertyID']
is not set, return with amissing_required_param
error.analyticsadsenselinks
service and return$analyticsadmin->properties_adSenseLinks->listPropertiesAdSenseLinks( $parent )
, where the$parent
should be the normalized property ID. ie.self::normalize_property_id ($data['propertyID'] )
.parse_data_response()
method, add a case for the above datapoint:(array) $response->getAdsenseLinks()
.Test Coverage
QA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: