woocommerce / google-listings-and-ads

Sync your store with Google to list products for free, run paid ads, and track performance straight from your store dashboard.
https://woo.com/products/google-listings-and-ads/
GNU General Public License v3.0
45 stars 21 forks source link

Enable labeling of Ads campaigns #2485

Closed jorgemd24 closed 1 month ago

jorgemd24 commented 1 month ago

Changes proposed in this Pull Request:

Part of pcTzPl-2nS-p2

We would like to track where campaigns are created from by labeling them with their source of creation. For example, use wc-gla for the web version, and for the mobile versions, something like wc-gla-android or wc-gla-ios.

This PR allows the creation of a new campaign with a specific label. Note that I haven't updated the frontend to send the label query parameter yet, as I would first like to define the label names we'll be using.

Screenshots:

Detailed test instructions:

  1. Make the following call POST wp-json/wc/gla/ads/campaigns with this body:
    {
    "amount": 0.01,
    "targeted_locations": ["ES"],
    "label": "wc-gla"
    }
    1. The campaign should be created successfully.
    2. Go to https://ads.google.com/
    3. Filter your campaign by label:

image

You should see the campaign that you just created.

  1. Alternatively, you can customize the campaigns table to display the labels:

image

image

image

Additional details:

Changelog entry

Add - Enable labeling of Ads campaigns

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 64.9%. Comparing base (f398161) to head (10d296c).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485/graphs/tree.svg?width=650&height=150&src=pr&token=UROWUPF1LX&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce)](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) ```diff @@ Coverage Diff @@ ## develop #2485 +/- ## =========================================== + Coverage 64.5% 64.9% +0.4% - Complexity 4564 4575 +11 =========================================== Files 795 475 -320 Lines 22844 17856 -4988 Branches 1220 0 -1220 =========================================== - Hits 14739 11590 -3149 + Misses 7938 6266 -1672 + Partials 167 0 -167 ``` | [Flag](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) | Coverage Δ | | |---|---|---| | [js-unit-tests](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) | `?` | | | [php-unit-tests](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) | `64.9% <100.0%> (+0.1%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) | Coverage Δ | | |---|---|---| | [src/API/Google/AdsCampaign.php](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485?src=pr&el=tree&filepath=src%2FAPI%2FGoogle%2FAdsCampaign.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce#diff-c3JjL0FQSS9Hb29nbGUvQWRzQ2FtcGFpZ24ucGhw) | `97.2% <100.0%> (+<0.1%)` | :arrow_up: | | [src/API/Google/AdsCampaignLabel.php](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485?src=pr&el=tree&filepath=src%2FAPI%2FGoogle%2FAdsCampaignLabel.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce#diff-c3JjL0FQSS9Hb29nbGUvQWRzQ2FtcGFpZ25MYWJlbC5waHA=) | `100.0% <100.0%> (ø)` | | | [src/API/Google/Query/AdsCampaignLabelQuery.php](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485?src=pr&el=tree&filepath=src%2FAPI%2FGoogle%2FQuery%2FAdsCampaignLabelQuery.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce#diff-c3JjL0FQSS9Hb29nbGUvUXVlcnkvQWRzQ2FtcGFpZ25MYWJlbFF1ZXJ5LnBocA==) | `100.0% <100.0%> (ø)` | | | [...rc/API/Site/Controllers/Ads/CampaignController.php](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485?src=pr&el=tree&filepath=src%2FAPI%2FSite%2FControllers%2FAds%2FCampaignController.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce#diff-c3JjL0FQSS9TaXRlL0NvbnRyb2xsZXJzL0Fkcy9DYW1wYWlnbkNvbnRyb2xsZXIucGhw) | `100.0% <100.0%> (ø)` | | | [...nal/DependencyManagement/GoogleServiceProvider.php](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485?src=pr&el=tree&filepath=src%2FInternal%2FDependencyManagement%2FGoogleServiceProvider.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce#diff-c3JjL0ludGVybmFsL0RlcGVuZGVuY3lNYW5hZ2VtZW50L0dvb2dsZVNlcnZpY2VQcm92aWRlci5waHA=) | `94.8% <100.0%> (+<0.1%)` | :arrow_up: | ... and [322 files with indirect coverage changes](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2485/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce)