Skip to content

Commit

Permalink
updated to Google Ads API v14.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fblascogarma committed Sep 20, 2023
1 parent 875d653 commit 72bb1c6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Testimonial from a company who used this project:
>"We looked at your app in great detail and learnt a lot from it.
Your app worked like a charm and gave us a good sense of various components involved.
The [document](https://docs.google.com/document/d/10WyzDUNZTVHhenWgCopf3YyaRDsyoavc7aHuOAMJF6Y/edit?usp=sharing) you provided was also very helpful.
Thank you fo putting this together."
Thank you for putting this together."

# Assumptions & Prerequisites

Expand Down
Binary file modified api/__pycache__/edit_sc.cpython-39.pyc
Binary file not shown.
Binary file modified api/__pycache__/get_campaigns.cpython-39.pyc
Binary file not shown.
34 changes: 32 additions & 2 deletions api/get_campaigns.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def campaign_info(
campaign.serving_status,
campaign.start_date,
campaign.advertising_channel_sub_type,
campaign.advertising_channel_type,
metrics.average_cpc,
metrics.average_cpm,
metrics.clicks,
Expand All @@ -91,6 +92,7 @@ def campaign_info(
'campaign.serving_status, '
'campaign.start_date, '
'campaign.advertising_channel_sub_type, '
'campaign.advertising_channel_type, '
'metrics.average_cpc, '
'metrics.average_cpm, '
'metrics.clicks, '
Expand Down Expand Up @@ -148,9 +150,37 @@ def campaign_info(

# get campaign type name
# see this link for reference
# https://developers.google.com/google-ads/api/reference/rpc/v8/AdvertisingChannelSubTypeEnum.AdvertisingChannelSubType
# https://developers.google.com/google-ads/api/reference/rpc/v14/AdvertisingChannelSubTypeEnum.AdvertisingChannelSubType
# https://developers.google.com/google-ads/api/reference/rpc/v14/AdvertisingChannelTypeEnum.AdvertisingChannelType
if row.campaign.advertising_channel_sub_type == 0:
campaign_type = "Unspecified"
if row.campaign.advertising_channel_type == 0:
campaign_type = "Unspecified"
elif row.campaign.advertising_channel_type == 1:
campaign_type = "Unknown"
elif row.campaign.advertising_channel_type == 2:
campaign_type = "Search"
elif row.campaign.advertising_channel_type == 3:
campaign_type = "Display"
elif row.campaign.advertising_channel_type == 4:
campaign_type = "Shopping"
elif row.campaign.advertising_channel_type == 5:
campaign_type = "Hotel"
elif row.campaign.advertising_channel_type == 6:
campaign_type = "Video"
elif row.campaign.advertising_channel_type == 7:
campaign_type = "App Campaigns"
elif row.campaign.advertising_channel_type == 8:
campaign_type = "Local Ads"
elif row.campaign.advertising_channel_type == 9:
campaign_type = "Smart"
elif row.campaign.advertising_channel_type == 10:
campaign_type = "Performance Max"
elif row.campaign.advertising_channel_type == 11:
campaign_type = "Local Services"
elif row.campaign.advertising_channel_type == 12:
campaign_type = "Discovery"
elif row.campaign.advertising_channel_type == 13:
campaign_type = "Travel"
elif row.campaign.advertising_channel_sub_type == 1:
campaign_type = "Unknown"
elif row.campaign.advertising_channel_sub_type == 2:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Django==3.2.4
django-cors-headers==3.7.0
djangorestframework==3.12.4
google-ads==19.0.0
google-ads==22.0.0
google-api-python-client==2.36.0

0 comments on commit 72bb1c6

Please sign in to comment.