Script 329: Conversion Influencers
Purpose
The script identifies and labels the top 10 keywords based on cost per conversion over the last 60 days, requiring at least one conversion to be considered.
To Elaborate
The Python script is designed to analyze keyword performance data, specifically focusing on cost efficiency in generating conversions. It processes a dataset of keywords, evaluating them based on their cost per conversion over a 60-day period. The script identifies the top 10 keywords that have the highest cost efficiency, meaning they have the lowest cost per conversion, provided they have achieved at least one conversion. These top-performing keywords are then labeled as “Top Performer” in the output dataset. This process helps in recognizing the most effective keywords in terms of cost management and conversion success, aiding in optimizing marketing strategies and budget allocation.
Walking Through the Code
- Data Preparation
- The script begins by preparing the data, which involves sorting the input dataframe by cost per conversion in descending order. This ensures that the keywords with the highest cost efficiency are prioritized.
- Selection of Top Keywords
- It then selects the first 10 rows from the sorted dataframe. These rows represent the top 10 keywords based on their cost per conversion efficiency.
- Labeling Top Performers
- The script assigns the label “Top Performer” to the ‘Conversion Influencers’ column for these top 10 keywords. This label helps in easily identifying the most cost-effective keywords.
- Output Generation
- Finally, the script outputs the modified dataframe, which includes the top-performing keywords with their respective labels, facilitating further analysis or reporting.
Vitals
- Script ID : 329
- Client ID / Customer ID: 1306926109 / 60269815
- Action Type: Bulk Upload
- Item Changed: Keyword
- Output Columns: Account, Campaign, Group, Keyword, Match Type, Conversion Influencers
- Linked Datasource: M1 Report
- Reference Datasource: None
- Owner: Byron Porter (bporter@marinsoftware.com)
- Created by Byron Porter on 2023-10-04 22:30
- Last Updated by Byron Porter 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
RPT_COL_KEYWORD = 'Keyword'
RPT_COL_ACCOUNT = 'Account'
RPT_COL_CAMPAIGN = 'Campaign'
RPT_COL_GROUP = 'Group'
RPT_COL_MATCH_TYPE = 'Match Type'
RPT_COL_STATUS = 'Status'
RPT_COL_CONV = 'Conv.'
RPT_COL_COST_PER_CONV = 'Cost/Conv. $'
RPT_COL_CONVERSION_INFLUENCERS = 'Conversion Influencers'
BULK_COL_ACCOUNT = 'Account'
BULK_COL_CAMPAIGN = 'Campaign'
BULK_COL_GROUP = 'Group'
BULK_COL_KEYWORD = 'Keyword'
BULK_COL_MATCH_TYPE = 'Match Type'
BULK_COL_CONVERSION_INFLUENCERS = 'Conversion Influencers'
# Assign current date to a parameter
today = datetime.datetime.now(CLIENT_TIMEZONE).date()
# Copy the first 10 rows of input dataframe to a new dataframe **incoming report is sorted by highest cost/conv to the lowest cost/conv**
outputDf = inputDf.head(10)
outputDf[BULK_COL_CONVERSION_INFLUENCERS] = "Top Performer"
print("outputDf", tableize(outputDf))
Post generated on 2024-11-27 06:58:46 GMT