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

Expose GLA conversion ID in the Ads datastore #10274

Open
3 tasks
10upsimon opened this issue Feb 26, 2025 · 3 comments
Open
3 tasks

Expose GLA conversion ID in the Ads datastore #10274

10upsimon opened this issue Feb 26, 2025 · 3 comments
Labels
javascript Pull requests that update Javascript code Module: Ads Google Ads module related issues P0 High priority PHP Team S Issues for Squad 1 Type: Feature New feature

Comments

@10upsimon
Copy link
Collaborator

10upsimon commented Feb 26, 2025

Feature Description

As a dependency to #10257, there is a need to create a new REST controller to retrieve the value from the ads_conversion_action option, for use in the Ads module datastore. This is required in order to determine whether the warning notice should be surfaced for users manually entering the same Ads ID in Site Kit as was linked/configured/created in Google for WooCommerce.


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

Acceptance criteria

  • A new REST controller is created in Ads that retrieves the value of the ads_conversion_action option.
  • Updates to the Ads module datastore are made and a selector added to retrieve said value above, if it exists.
  • Ads datastore is updated to expose conversion ID from gla_ads_conversion_action option

Implementation Brief

Note: Since there was no need to protect the ID - it is already a public data, and fetching it was not time sensitive, approach was changed to store it in inline data

  • Implement Google\Site_Kit\Modules\Ads::get_datapoint_definitions method
    • It should define GET:gla-connected-ads-id
    • Leave empty string for service
    • You can see an example of this, and method bellow in any other module class
  • Implement Google\Site_Kit\Modules\Ads::create_data_request
    • Include GET:gla-connected-ads-id route callback, it should:
    • Retrieve gla_ads_conversion_action option value. It will be an array if option exists
      • Return early if option does not exists
    • Access value from conversion_id key of the retrieved array, and if set return it as response
  • Add assets/js/modules/ads/datastore/google-listings-and-ads.js
    • Store the value in new initialState, say glaConnectedAdsId, with undefined as initial value
    • Add a fetch store fetchGetGLAConnectedAdsIdStore
      • it should retrieve the ads id from the newly added REST route (modules, ads, gla-connected-ads-id)
    • Add getGLAConnectedAdsId resolver to retrieve the data by invoking the fetch store
    • Add getGLAConnectedAdsId selector to return value from the state
    • Include the new datastore partial to the MODULES_ADS datastore

Test Coverage

  • Add basic test coverage for the new datastore partial

QA Brief

  • Setup Site Kit with adsPax feature flag enabled
  • Go to Site Kit dashboard and paste this snippet in the console: await googlesitekit.data.select('modules/ads').getGoogleForWooCommerceConversionID()
  • It should output empty string ''
  • Activate and setup Google for WooCommerce plugin, after you complete the setup and connect it with Ads campaign go to dashboard and output the same snippet, it shoukld output the connected conversion ID, in will be in format of AW-xxxx

Changelog entry

  • N/A
@10upsimon 10upsimon added javascript Pull requests that update Javascript code Module: Ads Google Ads module related issues P0 High priority PHP Team S Issues for Squad 1 Type: Feature New feature labels Feb 26, 2025
@zutigrm
Copy link
Collaborator

zutigrm commented Feb 26, 2025

AC ✅

@zutigrm zutigrm assigned 10upsimon and unassigned zutigrm Feb 26, 2025
@10upsimon
Copy link
Collaborator Author

@zutigrm IB LGTM ✅ , thank you! Moving to EB.

@10upsimon 10upsimon assigned zutigrm and unassigned 10upsimon Feb 26, 2025
@zutigrm zutigrm changed the title Create REST Controller to Retrieve ads_conversion_action Option Value & Surface in Ads Datastore Expose GLA conversion ID in the Ads datastore Feb 26, 2025
@zutigrm zutigrm removed their assignment Feb 27, 2025
@tofumatt tofumatt assigned tofumatt and unassigned tofumatt Feb 27, 2025
@mohitwp
Copy link
Collaborator

mohitwp commented Feb 28, 2025

QA Update ✅

  • Tested on dev environment.
  • Verified that when Google for WooCommerce plugin, was not Activated and setup on that time running code snippet await googlesitekit.data.select('modules/ads').getGoogleForWooCommerceConversionID() output empty string ''.
  • Verified that after we complete the setup of Google For WooCommerce plugin and connect it with Ads campaign go to dashboard and output the same snippet, it output the connected conversion ID, in will be in format of AW-xxxx.

Not Connected and Setup

Image

Connected and Setup

Image

Recording.1836.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code Module: Ads Google Ads module related issues P0 High priority PHP Team S Issues for Squad 1 Type: Feature New feature
Projects
None yet
Development

No branches or pull requests

4 participants