Last active
November 19, 2024 19:36
-
-
Save anilpai/d38b59be224d4a6255d939cdf4225998 to your computer and use it in GitHub Desktop.
Performance Marketing Optimization Strategies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# Set random seed for reproducibility | |
np.random.seed(42) | |
# Platforms and other variables | |
platforms = ['Google', 'Meta', 'Bing', 'LinkedIn'] | |
campaigns = ['Campaign A', 'Campaign B', 'Campaign C'] | |
audiences = ['Audience 1', 'Audience 2', 'Audience 3'] | |
# Generate synthetic data | |
data_list = [] | |
for platform in platforms: | |
for _ in range(100): | |
entry = { | |
'Platform': platform, | |
'Campaign': np.random.choice(campaigns), | |
'Audience': np.random.choice(audiences), | |
'Impressions': np.random.randint(1000, 10000), | |
'Clicks': np.random.randint(100, 1000), | |
'Conversions': np.random.randint(10, 100), | |
'Cost': np.random.uniform(500, 5000), | |
'Revenue': np.random.uniform(1000, 10000) | |
} | |
data_list.append(entry) | |
# Create DataFrame | |
data = pd.DataFrame(data_list) | |
# Calculate performance metrics | |
data['CTR'] = data['Clicks'] / data['Impressions'] | |
data['CPC'] = data['Cost'] / data['Clicks'] | |
data['CPA'] = data['Cost'] / data['Conversions'] | |
data['ROAS'] = data['Revenue'] / data['Cost'] | |
# Cross-platform performance comparison | |
platform_performance = data.groupby('Platform').agg({ | |
'Impressions': 'sum', | |
'Clicks': 'sum', | |
'Conversions': 'sum', | |
'Cost': 'sum', | |
'Revenue': 'sum' | |
}).reset_index() | |
platform_performance['CTR'] = platform_performance['Clicks'] / platform_performance['Impressions'] | |
platform_performance['CPC'] = platform_performance['Cost'] / platform_performance['Clicks'] | |
platform_performance['CPA'] = platform_performance['Cost'] / platform_performance['Conversions'] | |
platform_performance['ROAS'] = platform_performance['Revenue'] / platform_performance['Cost'] | |
print(platform_performance) | |
# Analyze audience performance across platforms | |
audience_performance = data.groupby(['Platform', 'Audience']).agg({ | |
'Impressions': 'sum', | |
'Clicks': 'sum', | |
'Conversions': 'sum', | |
'Cost': 'sum', | |
'Revenue': 'sum' | |
}).reset_index() | |
audience_performance['CTR'] = audience_performance['Clicks'] / audience_performance['Impressions'] | |
audience_performance['CPC'] = audience_performance['Cost'] / audience_performance['Clicks'] | |
audience_performance['CPA'] = audience_performance['Cost'] / audience_performance['Conversions'] | |
audience_performance['ROAS'] = audience_performance['Revenue'] / audience_performance['Cost'] | |
print(audience_performance) | |
# Visualize ROAS by Platform | |
plt.bar(platform_performance['Platform'], platform_performance['ROAS']) | |
plt.title('ROAS by Platform') | |
plt.xlabel('Platform') | |
plt.ylabel('ROAS') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CTR Analysis:
ROAS Ranking:
Key Insight: While LinkedIn leads in CTR, it has the lowest ROAS, suggesting that higher click-through rates don't necessarily translate to better return on investment.
Top Performers by Conversions:
Revenue Generation:
Meta: $556,089.95
Google: $546,251.83
Bing: $519,701.40
LinkedIn: $501,932.79
COST EFFICIENCY ANALYSIS
CPC Comparison:
CPA Analysis:
Meta Audiences:
Google Audiences:
LinkedIn Audiences:
Top ROAS by Audience:
Lowest Performing Audiences:
LinkedIn Audience 3: 1.65
Bing Audience 1: 1.66
LinkedIn Audience 1: 1.67
CORRELATION FINDINGS
Key Correlations:
CTR and ROAS:
CPC and ROAS:
Conversion Volume and Revenue:
STRATEGIC RECOMMENDATIONS:
A. Short-term actions:
B. Mid-term strategy:
Phase 1: Audience Optimization
Phase 2: Bid Strategy Testing
Phase 3: Creative Optimization
MEASUREMENT FRAMEWORK:
Primary Metrics:
Secondary Metrics: