Script 315: NOLS NOLM Backorder keywords

Purpose

The Python script processes input data to update specific columns with predefined values for managing backorder keywords in a marketing context.

To Elaborate

The script is designed to handle the structured allocation of budget and resources for marketing campaigns, specifically focusing on managing backorder keywords. It processes input data by copying specific columns from the input to the output and then updates certain fields with predefined values. This ensures that the marketing campaigns are adjusted to account for alternative products when the primary product is unavailable. The script sets specific parameters such as search bid values and custom parameters to facilitate this adjustment. The business rules embedded in the script ensure that the campaigns are automatically updated to reflect the availability of alternative products, thereby optimizing the marketing strategy and maintaining campaign effectiveness even when primary products are backordered.

Walking Through the Code

  1. Data Copying: The script begins by copying specific columns from the input data to the output data. This includes columns for account, campaign, and group, ensuring that the essential structure of the marketing data is preserved.

  2. Column Updates:

    • The script sets the ‘Search Bid’ column to a fixed value of ‘0.5’, which is a user-changeable parameter that determines the bid amount for search campaigns.
    • It updates the ‘Alternative Product Required’ column to “true”, indicating that an alternative product should be considered.
    • The ‘altproducttag’ column is set to a specific tag ‘#pdpSection_PFProdSubstit’, which is used to identify alternative products.
    • The ‘Custom Parameters’ column is updated with a string that includes the alternative product tag, facilitating the tracking and management of alternative products within the campaign.

Vitals

  • Script ID : 315
  • Client ID / Customer ID: 1306917929 / 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:17
  • 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