Script 271: NOLS NOLM & Backorder

Purpose

The script updates custom parameters for keywords containing “NOLS,” “NOLM,” or “Backorder” in a specific column of a landing page result.

To Elaborate

The Python script is designed to update specific custom parameters for keywords that include “NOLS,” “NOLM,” or “Backorder” within a designated column of a landing page result. This involves copying relevant data from an input DataFrame to an output DataFrame while setting specific values for certain columns. The script ensures that the keywords are associated with the correct account, campaign, and group, and assigns predefined values to columns such as search bid, alternative product tag, and custom parameters. This process is crucial for maintaining accurate and up-to-date keyword information, which can impact the effectiveness of marketing campaigns and product availability communication.

Walking Through the Code

  1. Initialization and Data Copying
    • The script begins by defining constants for column names, which are used to reference specific columns in the DataFrame.
    • It copies data from the input DataFrame to the output DataFrame, ensuring that the account, campaign, and group information is preserved.
  2. Setting Default Values
    • The script sets a default search bid value of ‘0.5’ for all entries in the output DataFrame.
    • It assigns a specific tag ‘#pdpSection_PFProdSubstit’ to the alternative product tag column.
    • The alternative product required column is set to “true,” indicating that an alternative product is necessary.
    • Custom parameters are updated with a predefined string ‘{_altproduct}=[altproducttag]’ to ensure consistency in parameter settings.

Vitals

  • Script ID : 271
  • Client ID / Customer ID: 1306917941 / 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-08-03 10:04
  • 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