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.
What Changed
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`.
campaign_criterion = client.get_service('CampaignCriterionService').get_campaign_criterion(resource_name='customers/123/campaignCriteria/456~789')campaign_criterion = client.get_service('CampaignCriterionService').get_campaign_criterion(resource_name='customers/123/campaignCriteria/456~789~KEYWORD_KEYWORD')Asset Field Type Enum Changes
Several enum values in `AssetFieldType` have been renamed to be more descriptive. For example, `HEADLINE` is now `HEADLINE_ASSET`.
asset = client.get_service('AssetService').get_asset(resource_name='customers/123/assets/abc')asset = client.get_service('AssetService').get_asset(resource_name='customers/123/assets/abc')Migration Steps
- 1
Review Release Notes and Breaking Changes
codeThoroughly 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
Update SDK/Client Libraries
configEnsure 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
Modify Code for Enum Changes
codeUpdate 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
Implement Comprehensive Testing
testWrite 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
Perform Staging Deployment and Testing
deployDeploy 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
Deploy to Production
deployOnce 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
Verify Post-Deployment Functionality
verifyAfter 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.
Verify Campaign Criterion Creation/Update
Programmatically create or update a campaign criterion and check if it reflects the new enum type.
- 2.
Verify Asset Upload/Retrieval
Upload a new asset and retrieve it, ensuring the asset field types are correctly interpreted.
- 3.
Check Report Generation
Generate sample reports that include campaign or asset data to ensure integrity.
- 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