Repository navigation
Geo exclusions and ad schedule on draft_campaign and update_campaign - #121
Open
illia-sapryga wants to merge 1 commit into
Open
illia-sapryga wants to merge 1 commit into
illia-sapryga wants to merge 1 commit into
Conversation
draft_campaign puts them in the campaign's atomic mutate. update_campaign replaces the whole list: omitted leaves it, [] clears it. The preview shows the current values and apply refuses if they changed after it; only the entries that differ are removed or added. Windows use add_ad_schedule's validation. A first schedule and clearing a schedule need a double confirmation, as does dropping a geo exclusion.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Today a new campaign needs follow-up plans for its exclusions and its schedule:
add_negative_locationsandadd_ad_schedule, each previewed and applied after the campaign exists. There is also no way to say "this is the complete list" on an existing campaign. You have to work out the difference yourself and go throughremove_entityone criterion at a time.This adds
geo_exclude_idsandad_scheduleto both tools, as parameters rather than new tools.On
draft_campaignthey go in the campaign's atomic mutate, so a failure leaves nothing behind.On
update_campaignthey replace the whole list: omitted leaves it,[]clears it. The preview showscurrent_geo_exclude_idsandcurrent_ad_schedule, and apply re-reads them and refuses if they moved after the preview. Only the entries that differ are removed or added, so a window or exclusion that stays keeps its criterion and history. Exclusion removals go before the positive geo operations and exclusion creates after them, so a location can move between the two lists in one request.Windows go through
_validate_schedule, so the rules are the onesadd_ad_schedulehas. Double confirmation:add_ad_schedule's logic and warning text (now a shared helper)One thing you may want to decide: I also ask for the double confirmation when
draft_campaignsets a schedule, so the first-schedule rule is the same everywhere. The campaign is new and PAUSED, so nothing is being switched off, and the dialog says "cannot be undone". If you'd rather have only the warning there, it's one line.When
geo_exclude_idsis passed next togeo_target_ids, the "negative exclusions will be preserved" warning no longer appears, since they are being replaced. A list with a blank entry is refused, so[" "]can't quietly clear the exclusions. Passing the values a campaign already has comes back as nothing to change.What it does not do:
add_negative_locationsandadd_ad_schedulestay as they are, for adding to what's there. An exclusion that overlapsgeo_target_idsin the same call is refused, but an overlap with the campaign's existing positive targets is left to Google's answer in the dry run.Tested with the full suite plus
tests/test_campaign_geo_exclude_schedule.py. Plans run throughconfirm_and_apply(dry_run=True)with real protos and the real validate-only wrapper, and fake services that only record the request. GAQL reads are stubbed. I have not run this code against a live account, so Google's answer to the replacement requests is untested, including the removal order.