Script 317: NOLS

Purpose

The Python script processes input data to set specific default values for certain columns related to advertising campaigns.

To Elaborate

The Python script is designed to process a dataset containing information about advertising campaigns. It takes input data and assigns default values to specific columns, which are likely used for managing and optimizing online advertising efforts. The script ensures that each campaign entry has a predefined search bid, a tag for alternative products, and a flag indicating whether an alternative product is required. Additionally, it sets custom parameters for each entry, which might be used for tracking or further customization in the advertising platform. This automation helps streamline the setup and management of advertising campaigns by ensuring consistency and reducing manual input errors.

Walking Through the Code

  1. Initialization and Setup:
    • The script begins by defining constants for column names that are used throughout the script. These constants represent different attributes of advertising campaigns, such as account, campaign, group, and various settings related to alternative products and search bids.
  2. Data Processing:
    • The script copies specific columns from the input dataset to the output dataset. This ensures that the essential information about each campaign is retained.
    • It sets a default search bid value of ‘0.5’ for each campaign entry, which might be a starting point for bid adjustments.
    • The script assigns a specific tag to the ‘Alternative Product Tag’ column and marks the ‘Alternative Product Required’ column as “true”, indicating that alternative products should be considered.
    • Custom parameters are set for each entry, potentially for tracking purposes or further customization in the advertising platform.
  3. Output and Display:
    • The script prints the input data in a tabular format, which helps in verifying the data before and after processing.

Vitals

  • Script ID : 317
  • Client ID / Customer ID: 1306923155 / 64302
  • Action Type: Bulk Upload
  • Item Changed: AdGroup
  • Output Columns: Account, Campaign, Group, Custom Parameters, Alternative Product Required, altproducttag
  • Linked Datasource: M1 Report
  • Reference Datasource: None
  • Owner: Tom McCaughey (tmccaughey@marinsoftware.com)
  • Created by Tom McCaughey on 2023-09-22 13:32
  • Last Updated by Tom McCaughey 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
BULK_COL_ACCOUNT = 'Account'
BULK_COL_CAMPAIGN = 'Campaign'
BULK_COL_GROUP = 'Group'
BULK_COL_CUSTOM_PARAMETERS = 'Custom Parameters'
BULK_COL_ALTERNATIVE_PRODUCTREQUIRED = 'Alternative Product Required'
BULK_COL_ALTPRODUCTTAG = 'altproducttag'
BULk_COL_SEARCH_BID = 'Search Bid'

# copy all input rows to output
#outputDf = inputDf.copy()
outputDf[BULK_COL_ACCOUNT] = inputDf[BULK_COL_ACCOUNT]
outputDf[BULK_COL_CAMPAIGN] = inputDf[BULK_COL_CAMPAIGN]
outputDf[BULK_COL_GROUP] = inputDf[BULK_COL_GROUP]
outputDf[BULk_COL_SEARCH_BID] = '0.5'
outputDf[BULK_COL_ALTPRODUCTTAG] = '#pdpSection_PFProdSubstit'
outputDf[BULK_COL_ALTERNATIVE_PRODUCTREQUIRED] = "true"
outputDf[BULK_COL_CUSTOM_PARAMETERS] = '{_altproduct}=[altproducttag]'

today = datetime.datetime.now(CLIENT_TIMEZONE).date()
print(tableize(inputDf))

Post generated on 2024-11-27 06:58:46 GMT

comments powered by Disqus