Script 453: Automate ProductGroup SetBidOverride

Purpose

Python script to set all active Google Product Groups to Bid Override with no end date.

To Elaborate

The Python script automates the process of setting all active Google Product Groups to Bid Override with no end date. This is useful for managing bids for different product groups in Google Ads. By setting the bid override to “On” for all active product groups, advertisers can have more control over their bidding strategy and optimize their campaigns more effectively.

Walking Through the Code

  1. The script defines column constants for various data columns used in the code.
  2. It checks if the “Bid Override” column in the input DataFrame contains the value “Off”.
  3. If the condition is true, it creates a new DataFrame called “overrideoffDf” with the relevant columns from the input DataFrame.
  4. It sets the value of the “Bid Override” column in the “overrideoffDf” DataFrame to “On”.
  5. The script merges the “overrideoffDf” DataFrame with the “outputDf” DataFrame.
  6. Finally, it prints the tableized version of the “outputDf” DataFrame.

Vitals

  • Script ID : 453
  • Client ID / Customer ID: 1306912103 / 60267913
  • Action Type: Bulk Upload (Preview)
  • Item Changed: Product Group
  • Output Columns: Account, Campaign, Group, Product Group ID, Bid Override
  • Linked Datasource: M1 Report
  • Reference Datasource: None
  • Owner: Grégory Pantaine (gpantaine@marinsoftware.com)
  • Created by Grégory Pantaine on 2023-10-30 10:29
  • Last Updated by Grégory Pantaine on 2023-12-06 04:01
> See it in Action

Python Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Author: Gregory Pantaine
# Created: 2023-10-27
# Description: set all active Google Product Groups to Bid Override with no end date.
# Scripts name: Automate-ProductGroup-SetBidOverride
# Report name (M1):


RPT_COL_CAMPAIGN = 'Group'
RPT_COL_CAMPAIGN = 'Campaign'
RPT_COL_ACCOUNT = 'Account'
RPT_COL_OVERRIDE = 'Bid Override'
RPT_COL_PGID = 'Product Group ID'
BULK_COL_ACCOUNT = 'Account'
BULK_COL_CAMPAIGN = 'Campaign'
BULK_COL_BID_OVER = 'Bid Override'
BULK_COL_GROUP = 'Group'
BULK_COL_PGID = 'Product Group ID'


# Check if RPT_COL_OVERRIDE column has 'Off'
bcheck = (inputDf[RPT_COL_OVERRIDE].str.contains('Off', case=True, na=False))

# Use check to create one DataFrame for Off, to change to on.
overrideoffDf = inputDf.loc[bcheck, [BULK_COL_ACCOUNT, BULK_COL_CAMPAIGN, BULK_COL_GROUP, BULK_COL_PGID, BULK_COL_BID_OVER]]
overrideoffDf.loc[:, BULK_COL_BID_OVER] = 'On'

# Merges the Brand and Non-Brand dataframes
outputDf = overrideoffDf

# Print the tableized version of the output DataFrame
print(tableize(outputDf))

Post generated on 2024-05-15 07:44:05 GMT

comments powered by Disqus