Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Analytics 4 conversion events REST data point #6348

Closed
asvinb opened this issue Dec 21, 2022 · 5 comments
Closed

Implement Analytics 4 conversion events REST data point #6348

asvinb opened this issue Dec 21, 2022 · 5 comments
Labels
P0 High priority Type: Enhancement Improvement of an existing feature

Comments

@asvinb
Copy link
Collaborator

asvinb commented Dec 21, 2022

Feature Description

Similar to the Analytics goals REST endpoint, a new endpoint should be created for Analytics 4 called conversion-events (as goals no longer exists in GA4, but instead has conversion events)


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

Acceptance criteria

  • A new REST data point GET:conversion-events should be added to the Analytics_4 module class.
    • It should return the list of conversion events for a given property.

Implementation Brief

  • Using includes/Modules/Analytics_4.php,
    • Add GET:conversion-events to the array in get_datapoint_definitions and the service should be analyticsadmin.
    • In create_data_request, add the case for the new datapoint where a list of conversion events is returned for a property.
      • This can be done by using the listPropertiesConversionEvents method of $this->get_service( 'analyticsadmin' )->properties_conversionEvents passing the property ID as parameter.
    • Add corresponding case in parse_data_response to return only the list of conversion events rather than the full response

Test Coverage

  • Add tests for the conversion-events REST endpoint. See the existing tests for the GA4 report datapoint for a good starting point.

QA Brief

QA:Eng

  • Set up Site Kit with Analytics and GA4.
  • In a Site Kit screen, run the following in the browser console (replace GA4_PROPERTY_ID with your GA4 property ID):
googlesitekit.api.get( 'modules', 'analytics-4', 'conversion-events', { propertyID: GA4_PROPERTY_ID }, { useCache: false } )
  • Verify that a GET request is made to the /modules/analytics-4/data/conversion-events?propertyID=GA4_PROPERTY_ID.
  • The request should return a 200 response with an array of objects, each object being a conversion event. Example:

1

Changelog entry

  • Add a new endpoint for the Analytics 4 module to list conversion events.
@aaemnnosttv aaemnnosttv added P1 Medium priority Type: Enhancement Improvement of an existing feature labels Dec 22, 2022
@aaemnnosttv
Copy link
Collaborator

This LGTM for the most part. The main thing missing is a corresponding addition to parse_data_response where we return the subject of the request (i.e. the list of conversion events) rather than all the other top-level bits such as pagination tokens, etc.

As for the tests, this would be good to add although coverage for data points like this has always been very minimal. The work @techanvil is doing on the tests for the report datapoint now should serve as a good example to follow here as well.

I'll add this missing detail to the IB and bump the estimate to unblock this, then it should be good to go 👍

@aaemnnosttv
Copy link
Collaborator

IB ✅

@aaemnnosttv aaemnnosttv removed their assignment Jan 10, 2023
@eclarke1 eclarke1 added P0 High priority and removed P1 Medium priority labels Jan 12, 2023
@nfmohit nfmohit self-assigned this Jan 15, 2023
@nfmohit nfmohit added the QA: Eng Requires specialized QA by an engineer label Jan 17, 2023
@nfmohit nfmohit removed their assignment Jan 17, 2023
@eugene-manuilov eugene-manuilov self-assigned this Jan 17, 2023
eugene-manuilov added a commit that referenced this issue Jan 17, 2023
…rsion-events

Add REST datapoint for GA4 conversion events
@eugene-manuilov eugene-manuilov removed their assignment Jan 17, 2023
@wpdarren
Copy link
Collaborator

@nfmohit unless you have any objections, I do not feel that this is a QA:Eng ticket. I have removed the label but let me know if you still feel it's worth an engineer looking at it.

@wpdarren wpdarren removed the QA: Eng Requires specialized QA by an engineer label Jan 18, 2023
@wpdarren wpdarren self-assigned this Jan 18, 2023
@nfmohit
Copy link
Collaborator

nfmohit commented Jan 18, 2023

Absolutely no objection from my side, thank you @wpdarren!

@wpdarren
Copy link
Collaborator

QA Update: ✅

Verified:

  • A GET request is made to the /modules/analytics-4/data/conversion-events?propertyID=GA4_PROPERTY_ID.
  • The request returns a 200 response with an array of objects, each object being a conversion event.

image

@wpdarren wpdarren removed their assignment Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 High priority Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

7 participants