Forked from limata3/create-experiment-adwords-API.py
Created
February 1, 2021 19:41
-
-
Save Sandy4321/901c835e66b058c38675cb1615e98d73 to your computer and use it in GitHub Desktop.
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
def create_experiment(experiment_name, base_campaign_id, draft_id, split_percent=50, split_type='COOKIE'): | |
adwords_client = connect_to_adwords_api() | |
trial_service = adwords_client.GetService('TrialService', version='v201809') | |
trial = { | |
'draftId': draft_id, | |
'baseCampaignId': base_campaign_id, | |
'name': experiment_name, | |
'trafficSplitPercent': split_percent, | |
'trafficSplitType': split_type | |
} | |
trial_operation = {'operator': 'ADD', 'operand': trial} | |
trial_id = trial_service.mutate([trial_operation])['value'][0]['id'] | |
return trial_id | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment