DeprecatrAI

Migrate from v21 to v22

Update your Google Ads API integration by addressing changes in campaign criteria and asset field names to ensure compatibility with v22.

within 90 days~8h effort2 breaking changes

What Changed

High

Campaign Criterion Type Enum Changes

The enum values for `CampaignCriterion.type` have been updated, with some values renamed or removed. For instance, `KEYWORD` is now `KEYWORD_KEYWORD`.

Before
campaign_criterion = client.get_service('CampaignCriterionService').get_campaign_criterion(resource_name='customers/123/campaignCriteria/456~789')
After
campaign_criterion = client.get_service('CampaignCriterionService').get_campaign_criterion(resource_name='customers/123/campaignCriteria/456~789~KEYWORD_KEYWORD')
Medium

Asset Field Type Enum Changes

Several enum values in `AssetFieldType` have been renamed to be more descriptive. For example, `HEADLINE` is now `HEADLINE_ASSET`.

Before
asset = client.get_service('AssetService').get_asset(resource_name='customers/123/assets/abc')
After
asset = client.get_service('AssetService').get_asset(resource_name='customers/123/assets/abc')

Migration Steps

  1. 1

    Review Release Notes and Breaking Changes

    code

    Thoroughly read the official Google Ads API v22 release notes. Pay close attention to the identified breaking changes, especially those affecting `CampaignCriterion.type` and `AssetFieldType`.

    • Check for any other deprecated fields or services.
    • Note down all specific enum value changes.
  2. 2

    Update SDK/Client Libraries

    config

    Ensure you are using the latest compatible version of the Google Ads API client library for your programming language. This will include the updated definitions for v22.

    • Use your package manager (e.g., pip, npm, Maven) to update.
    • Check library compatibility notes if available.
  3. 3

    Modify Code for Enum Changes

    code

    Update your codebase to reflect the renamed enum values for `CampaignCriterion.type` and `AssetFieldType`. This involves searching for and replacing the old enum names with their new counterparts.

    • Use search-and-replace with caution; ensure context.
    • Consider writing small scripts to automate enum updates if there are many occurrences.
  4. 4

    Implement Comprehensive Testing

    test

    Write or update unit and integration tests to cover the modified code paths. Ensure that campaigns, criteria, and assets are being handled and reported correctly after the changes.

    • Mock API responses to isolate your code.
    • Include tests for edge cases and invalid inputs.
  5. 5

    Perform Staging Deployment and Testing

    deploy

    Deploy your updated application to a staging environment that mirrors your production setup. Conduct thorough end-to-end testing to validate the migration's impact on your application's functionality.

    • Use a dedicated staging environment.
    • Monitor logs for any unexpected errors.
  6. 6

    Deploy to Production

    deploy

    Once confident in the staging environment, proceed with the production deployment. Monitor your application closely after deployment for any unforeseen issues or performance degradation.

    • Consider a phased rollout if possible.
    • Have a rollback plan in place.
  7. 7

    Verify Post-Deployment Functionality

    verify

    After production deployment, actively monitor key metrics and logs. Verify that all Google Ads API interactions are functioning as expected and that data is being processed correctly.

    • Check critical API calls first.
    • Monitor user feedback and error reports.

Testing Checklist

  1. 1.

    Verify Campaign Criterion Creation/Update

    Programmatically create or update a campaign criterion and check if it reflects the new enum type.

  2. 2.

    Verify Asset Upload/Retrieval

    Upload a new asset and retrieve it, ensuring the asset field types are correctly interpreted.

  3. 3.

    Check Report Generation

    Generate sample reports that include campaign or asset data to ensure integrity.

  4. 4.

    Test Error Handling

    Simulate API errors related to invalid criterion or asset types and verify graceful handling.

Common Mistakes

Ignoring specific enum renames in `CampaignCriterion.type` and `AssetFieldType`.

API calls will fail with `INVALID_ENUM_VALUE` errors, leading to campaign or asset management failures.

Carefully map old enum values to their new names and update all relevant code sections.

Not updating the Google Ads API client library to the latest version.

The application may still use outdated API definitions, leading to unexpected errors even after manual code changes.

Always update the SDK to the version corresponding to the target API version (v22).

Insufficient testing of modified API interactions.

Production issues may arise due to overlooked bugs in how new enum values are handled, affecting campaign performance or asset reporting.

Implement thorough unit, integration, and end-to-end tests covering all affected API calls.

Never get blindsided by an API change again

Deprecatr AI monitors 150+ providers, maps changes to your codebase, and delivers migration checklists before your team hits a breaking change.

Join the Waitlist