import streamlit as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly.express as px
import plotly.graph_objects as go
from datetime import datetime, timedelta
import random
import time
from PIL import Image
# Set up the page
st.set_page_config(page_title="AI Marketing & Growth Dashboard", layout="wide")
# Custom CSS for styling
st.markdown("""
""", unsafe_allow_html=True)
# Sidebar navigation
st.sidebar.title("AI Marketing & Growth Dashboard")
st.sidebar.image("https://cdn-icons-png.flaticon.com/512/3135/3135706.png", width=100)
page = st.sidebar.selectbox("Navigate to", [
"Dashboard Overview",
"AI Cold Email Icebreaker Generator",
"AI Product Launch Checklist Creator",
"AI Competitor Ad Spy Tool",
"AI Influencer ROI Calculator",
"AI Podcast Episode Idea Generator",
"AI SEO Backlink Opportunity Finder",
"AI Content Virality Predictor",
"AI Marketing Campaign ROI Simulator",
"AI Smart Customer Persona Builder"
])
# Sample data generation functions
def generate_marketing_data():
dates = pd.date_range(start='2023-10-01', end=datetime.today(), freq='D')
website_traffic = [random.randint(500, 2000) for _ in range(len(dates))]
conversions = [random.randint(20, 100) for _ in range(len(dates))]
conversion_rate = [c/t*100 for c, t in zip(conversions, website_traffic)]
df = pd.DataFrame({
'Date': dates,
'Website_Traffic': website_traffic,
'Conversions': conversions,
'Conversion_Rate': conversion_rate
})
return df
def generate_social_media_data():
platforms = ['Facebook', 'Instagram', 'Twitter', 'LinkedIn', 'TikTok']
engagement = [random.randint(500, 5000) for _ in range(len(platforms))]
followers = [random.randint(1000, 50000) for _ in range(len(platforms))]
growth_rate = [random.uniform(0.5, 5.0) for _ in range(len(platforms))]
df = pd.DataFrame({
'Platform': platforms,
'Engagement': engagement,
'Followers': followers,
'Growth_Rate': growth_rate
})
return df
def generate_campaign_data():
campaigns = ['Q3 Product Launch', 'Holiday Sale', 'Webinar Series', 'Email Nurture', 'Social Media Blitz']
spend = [random.randint(5000, 20000) for _ in range(len(campaigns))]
revenue = [s * random.uniform(1.5, 4.0) for s in spend]
roi = [(r - s) / s * 100 for r, s in zip(revenue, spend)]
df = pd.DataFrame({
'Campaign': campaigns,
'Spend': spend,
'Revenue': revenue,
'ROI': roi
})
return df
# Dashboard Overview
if page == "Dashboard Overview":
st.markdown('
AI Marketing & Growth Dashboard
', unsafe_allow_html=True) # Marketing summary col1, col2, col3, col4 = st.columns(4) with col1: st.markdown('', unsafe_allow_html=True)
st.metric("Website Traffic", "12.5K", "+8.2%")
st.markdown('
', unsafe_allow_html=True)
with col2:
st.markdown('', unsafe_allow_html=True)
st.metric("Conversion Rate", "4.3%", "+1.2%")
st.markdown('
', unsafe_allow_html=True)
with col3:
st.markdown('', unsafe_allow_html=True)
st.metric("Customer Acquisition Cost", "$42", "-5.7%")
st.markdown('
', unsafe_allow_html=True)
with col4:
st.markdown('', unsafe_allow_html=True)
st.metric("Marketing ROI", "285%", "+32%")
st.markdown('
', unsafe_allow_html=True)
# Marketing charts
st.subheader("Marketing Performance")
marketing_data = generate_marketing_data()
fig = go.Figure()
fig.add_trace(go.Scatter(x=marketing_data['Date'], y=marketing_data['Website_Traffic'],
mode='lines', name='Website Traffic', line=dict(color='#1f77b4')))
fig.add_trace(go.Scatter(x=marketing_data['Date'], y=marketing_data['Conversions'],
mode='lines', name='Conversions', line=dict(color='#d62728')))
fig.update_layout(height=400, xaxis_title='Date', yaxis_title='Count')
st.plotly_chart(fig, use_container_width=True)
# Social media performance
st.subheader("Social Media Performance")
social_data = generate_social_media_data()
fig2 = px.bar(social_data, x='Platform', y='Engagement',
title='Social Media Engagement by Platform')
fig2.update_layout(height=400)
st.plotly_chart(fig2, use_container_width=True)
# Campaign performance
st.subheader("Campaign Performance")
campaign_data = generate_campaign_data()
fig3 = px.bar(campaign_data, x='Campaign', y='ROI',
title='Campaign ROI Comparison')
fig3.update_layout(height=400)
st.plotly_chart(fig3, use_container_width=True)
# Recommended tools
st.subheader("Recommended Tools For You")
col1, col2, col3 = st.columns(3)
with col1:
st.markdown('', unsafe_allow_html=True)
st.write("📧 **Cold Email Generator**")
st.write("Create personalized cold emails that convert")
st.progress(0.8)
st.markdown('
', unsafe_allow_html=True)
with col2:
st.markdown('', unsafe_allow_html=True)
st.write("📊 **ROI Simulator**")
st.write("Predict campaign performance before spending")
st.progress(0.6)
st.markdown('
', unsafe_allow_html=True)
with col3:
st.markdown('', unsafe_allow_html=True)
st.write("🔍 **Competitor Analysis**")
st.write("Spy on competitor ads and strategies")
st.progress(0.7)
st.markdown('
', unsafe_allow_html=True)
# AI Cold Email Icebreaker Generator
elif page == "AI Cold Email Icebreaker Generator":
st.title("AI Cold Email Icebreaker Generator")
col1, col2 = st.columns(2)
with col1:
st.subheader("Prospect Information")
# Prospect details
prospect_name = st.text_input("Prospect Name")
company_name = st.text_input("Company Name")
industry = st.selectbox("Industry",
["Technology", "Finance", "Healthcare", "Education",
"Manufacturing", "Retail", "Other"])
# Connection points
connection_type = st.selectbox("Connection Type",
["Cold Outreach", "Referral", "Event", "Content", "Mutual Connection"])
if connection_type == "Event":
event_name = st.text_input("Event Name")
elif connection_type == "Content":
content_type = st.selectbox("Content Type",
["Blog Post", "Webinar", "Podcast", "Video", "Social Media"])
elif connection_type == "Mutual Connection":
mutual_connection = st.text_input("Mutual Connection Name")
# Value proposition
value_prop = st.text_area("Your Value Proposition",
"How can you help this prospect? What problem do you solve?")
if st.button("Generate Icebreakers"):
with st.spinner("Generating personalized icebreakers..."):
time.sleep(2)
with col2:
st.subheader("AI-Generated Icebreakers")
if prospect_name and company_name:
# Generate icebreakers based on inputs
icebreakers = []
# Generic icebreakers
icebreakers.append(f"I was impressed by {company_name}'s recent work in the {industry} industry and thought there might be synergy with what we're doing.")
# Connection-specific icebreakers
if connection_type == "Event":
icebreakers.append(f"It was great to see {company_name} at {event_name} recently. I particularly enjoyed your insights on [topic].")
elif connection_type == "Content":
icebreakers.append(f"I recently came across your {content_type.lower()} and was impressed by your perspective on [topic].")
elif connection_type == "Mutual Connection":
icebreakers.append(f"{mutual_connection} suggested I reach out, mentioning you might be interested in how we help companies like yours with [value prop].")
# Industry-specific icebreakers
if industry == "Technology":
icebreakers.append(f"Given {company_name}'s focus on technology innovation, I thought you might be interested in how we're helping tech companies solve [problem].")
elif industry == "Finance":
icebreakers.append(f"With {company_name}'s position in the financial sector, I wondered if you've encountered challenges with [problem] that we help solve.")
# Value-based icebreakers
if value_prop:
icebreakers.append(f"I'm reaching out because we've helped companies in your industry achieve [result] through our solution for [problem].")
# Display icebreakers
st.write("### Personalized Icebreakers")
for i, icebreaker in enumerate(icebreakers):
st.markdown(f'', unsafe_allow_html=True)
st.write(f"{icebreaker}")
st.markdown('
', unsafe_allow_html=True)
# Email template
st.write("### Complete Email Template")
email_template = f"""
Subject: Quick question about {company_name}
Hi {prospect_name},
{random.choice(icebreakers)}
{value_prop if value_prop else "We help companies like yours achieve [specific result] by solving [specific problem]."}
Would you be open to a brief 15-minute chat next week to explore if this might be relevant for {company_name}?
Best regards,
[Your Name]
[Your Title]
[Your Company]
[Your Email]
[Your Phone]
"""
st.text_area("Email Template", email_template, height=300)
# Download option
st.download_button(
label="Download Email Template",
data=email_template,
file_name=f"cold_email_{company_name.lower().replace(' ', '_')}.txt",
mime="text/plain"
)
else:
st.info("Enter prospect details to generate personalized icebreakers")
# AI Product Launch Checklist Creator
elif page == "AI Product Launch Checklist Creator":
st.title("AI Product Launch Checklist Creator")
col1, col2 = st.columns(2)
with col1:
st.subheader("Launch Details")
# Product details
product_name = st.text_input("Product Name")
product_type = st.selectbox("Product Type",
["SaaS", "Physical Product", "Mobile App", "Service", "Digital Product"])
target_audience = st.selectbox("Target Audience",
["B2B", "B2C", "Both"])
# Launch scale
launch_scale = st.select_slider("Launch Scale",
options=["Small", "Medium", "Large", "Enterprise"])
# Timeline
launch_date = st.date_input("Launch Date")
days_until_launch = (launch_date - datetime.today().date()).days
if st.button("Generate Checklist"):
with st.spinner("Creating your personalized launch checklist..."):
time.sleep(2)
with col2:
st.subheader("Product Launch Checklist")
if product_name:
st.metric("Days Until Launch", days_until_launch)
# Generate checklist based on inputs
checklist = []
# Pre-launch phase
pre_launch = [
"Finalize product features and specifications",
"Complete beta testing and gather feedback",
"Prepare product documentation and help resources",
"Set up customer support systems",
"Train sales and support teams on the product",
"Develop pricing strategy and packages",
"Set up billing and payment systems"
]
# Marketing phase
marketing = [
"Create landing page and website content",
"Develop email marketing campaign sequence",
"Prepare social media launch campaign",
"Create product demo videos and screenshots",
"Write press releases and media outreach",
"Plan launch event or webinar",
"Set up analytics and tracking"
]
# Post-launch phase
post_launch = [
"Monitor customer feedback and reviews",
"Address any immediate bugs or issues",
"Analyze launch performance metrics",
"Follow up with early customers for testimonials",
"Plan first product update based on feedback",
"Scale marketing efforts based on initial results",
"Review and optimize customer onboarding process"
]
# Add type-specific items
if product_type == "SaaS":
pre_launch.append("Set up cloud infrastructure and scaling plan")
pre_launch.append("Implement security measures and compliance")
elif product_type == "Physical Product":
pre_launch.append("Finalize manufacturing and supply chain")
pre_launch.append("Plan inventory management and logistics")
# Add audience-specific items
if target_audience == "B2B":
marketing.append("Develop case studies and whitepapers")
marketing.append("Plan account-based marketing strategy")
elif target_audience == "B2C":
marketing.append("Create influencer outreach campaign")
marketing.append("Plan social media advertising strategy")
# Display checklist
st.write("### Pre-Launch Phase")
for item in pre_launch:
st.checkbox(item)
st.write("### Marketing Phase")
for item in marketing:
st.checkbox(item)
st.write("### Post-Launch Phase")
for item in post_launch:
st.checkbox(item)
# Timeline visualization
st.subheader("Launch Timeline")
phases = ["Pre-Launch", "Marketing", "Post-Launch"]
phase_durations = [max(30, days_until_launch - 14), 14, 30]
fig = go.Figure(go.Bar(
x=phase_durations,
y=phases,
orientation='h',
marker_color=['#1f77b4', '#ff7f0e', '#2ca02c']
))
fig.update_layout(title='Recommended Phase Durations', height=300)
st.plotly_chart(fig, use_container_width=True)
else:
st.info("Enter product details to generate a launch checklist")
# AI Competitor Ad Spy Tool
elif page == "AI Competitor Ad Spy Tool":
st.title("AI Competitor Ad Spy Tool")
col1, col2 = st.columns(2)
with col1:
st.subheader("Competitor Analysis")
# Competitor details
competitor_name = st.text_input("Competitor Name")
industry = st.selectbox("Industry",
["Technology", "Finance", "Healthcare", "Education",
"E-commerce", "SaaS", "Other"])
# Analysis focus
analysis_focus = st.multiselect("Analysis Focus",
["Ad Copy", "Visuals", "Targeting", "Offers", "CTAs", "Landing Pages"])
# Time period
time_period = st.select_slider("Time Period",
options=["Last 7 days", "Last 30 days", "Last 90 days", "Last 6 months"])
if st.button("Analyze Competitor Ads"):
with st.spinner("Gathering competitor ad intelligence..."):
time.sleep(3)
with col2:
st.subheader("Competitor Ad Analysis")
if competitor_name:
# Simulated ad data
ad_themes = ["Price Discount", "Feature Highlight", "Social Proof", "Urgency", "Problem/Solution"]
ad_channels = ["Facebook", "Google", "Instagram", "LinkedIn", "YouTube"]
ad_metrics = {
"Estimated Spend": f"${random.randint(5000, 50000)}",
"Ad Frequency": f"{random.randint(5, 20)} times/week",
"Engagement Rate": f"{random.uniform(1.5, 5.2):.1f}%",
"CTR": f"{random.uniform(1.2, 4.8):.1f}%"
}
st.metric("Competitor", competitor_name)
# Ad themes
st.subheader("Top Ad Themes")
theme_data = pd.DataFrame({
'Theme': ad_themes,
'Frequency': [random.randint(10, 100) for _ in range(len(ad_themes))]
})
fig = px.bar(theme_data, x='Frequency', y='Theme', orientation='h',
title='Most Common Ad Themes')
fig.update_layout(height=300)
st.plotly_chart(fig, use_container_width=True)
# Channel distribution
st.subheader("Ad Channel Distribution")
channel_data = pd.DataFrame({
'Channel': ad_channels,
'Spend': [random.randint(1000, 15000) for _ in range(len(ad_channels))]
})
fig2 = px.pie(channel_data, values='Spend', names='Channel',
title='Estimated Ad Spend by Channel')
fig2.update_layout(height=300)
st.plotly_chart(fig2, use_container_width=True)
# Key insights
st.subheader("Key Insights")
insights = [
f"{competitor_name} focuses heavily on {random.choice(ad_themes)} messaging",
f"Their top performing channel is {random.choice(ad_channels)} with {ad_metrics['CTR']} CTR",
f"They seem to target {random.choice(['B2B decision makers', 'millennials', 'small businesses', 'enterprise clients'])}",
f"Common CTAs include: {random.choice(['Free trial', 'Request demo', 'Learn more', 'Buy now'])}",
f"Their estimated monthly ad spend is {ad_metrics['Estimated Spend']}"
]
for insight in insights:
st.markdown(f'', unsafe_allow_html=True)
st.write(f"💡 {insight}")
st.markdown('
', unsafe_allow_html=True)
# Recommended actions
st.subheader("Recommended Actions")
actions = [
"Test similar ad themes with your unique value proposition",
"Consider advertising on their top-performing channels",
"Analyze their landing page structure for conversion insights",
"Develop a differentiated messaging strategy to stand out",
"Monitor their ad frequency to identify optimal timing"
]
for action in actions:
st.write(f"• {action}")
else:
st.info("Enter a competitor name to analyze their ad strategy")
# AI Influencer ROI Calculator
elif page == "AI Influencer ROI Calculator":
st.title("AI Influencer ROI Calculator")
col1, col2 = st.columns(2)
with col1:
st.subheader("Influencer Campaign Details")
# Campaign parameters
influencer_fee = st.number_input("Influencer Fee ($)", min_value=100, max_value=100000, value=5000, step=500)
production_costs = st.number_input("Production Costs ($)", min_value=0, max_value=50000, value=1000, step=500)
expected_reach = st.number_input("Expected Reach", min_value=1000, max_value=10000000, value=50000, step=1000)
expected_engagement = st.slider("Expected Engagement Rate (%)", 0.1, 20.0, 3.5, 0.1)
# Conversion assumptions
conversion_rate = st.slider("Expected Conversion Rate (%)", 0.1, 10.0, 2.0, 0.1)
average_order_value = st.number_input("Average Order Value ($)", min_value=10, max_value=1000, value=85, step=5)
if st.button("Calculate ROI"):
with st.spinner("Calculating influencer campaign ROI..."):
time.sleep(2)
with col2:
st.subheader("ROI Projection")
# Calculate metrics
total_cost = influencer_fee + production_costs
expected_engagements = expected_reach * (expected_engagement / 100)
expected_conversions = expected_engagements * (conversion_rate / 100)
expected_revenue = expected_conversions * average_order_value
expected_roi = ((expected_revenue - total_cost) / total_cost) * 100 if total_cost > 0 else 0
# Display results
st.metric("Total Investment", f"${total_cost:,.2f}")
st.metric("Expected Revenue", f"${expected_revenue:,.2f}")
st.metric("Projected ROI", f"{expected_roi:.1f}%",
delta_color="normal" if expected_roi > 0 else "inverse")
# Break-even analysis
break_even_conversions = total_cost / average_order_value
break_even_engagement = (break_even_conversions / (conversion_rate / 100)) / expected_reach * 100
st.metric("Break-even Conversions", f"{break_even_conversions:.0f}")
st.metric("Break-even Engagement Rate", f"{break_even_engagement:.2f}%")
# Scenario analysis
st.subheader("Scenario Analysis")
scenarios = [
{"name": "Pessimistic", "engagement_multiplier": 0.7, "conversion_multiplier": 0.7},
{"name": "Expected", "engagement_multiplier": 1.0, "conversion_multiplier": 1.0},
{"name": "Optimistic", "engagement_multiplier": 1.3, "conversion_multiplier": 1.3}
]
scenario_data = []
for scenario in scenarios:
scenario_engagements = expected_engagements * scenario["engagement_multiplier"]
scenario_conversions = expected_conversions * scenario["conversion_multiplier"]
scenario_revenue = scenario_conversions * average_order_value
scenario_roi = ((scenario_revenue - total_cost) / total_cost) * 100
scenario_data.append({
"Scenario": scenario["name"],
"Engagements": scenario_engagements,
"Conversions": scenario_conversions,
"Revenue": scenario_revenue,
"ROI": scenario_roi
})
scenario_df = pd.DataFrame(scenario_data)
fig = px.bar(scenario_df, x='Scenario', y='ROI',
title='ROI by Scenario')
fig.update_layout(height=400)
st.plotly_chart(fig, use_container_width=True)
# Recommendations
st.subheader("Recommendations")
if expected_roi < 50:
st.markdown('', unsafe_allow_html=True)
st.write("⚠️ **Low ROI Projection**:")
st.write("- Negotiate lower influencer fees")
st.write("- Improve targeting to increase conversion rates")
st.write("- Consider micro-influencers with higher engagement")
st.markdown('
', unsafe_allow_html=True)
else:
st.markdown('', unsafe_allow_html=True)
st.write("✅ **Strong ROI Projection**:")
st.write("- Consider scaling with additional influencers")
st.write("- Develop a longer-term partnership")
st.write("- Create additional content assets for repurposing")
st.markdown('
', unsafe_allow_html=True)
# AI Podcast Episode Idea Generator
elif page == "AI Podcast Episode Idea Generator":
st.title("AI Podcast Episode Idea Generator")
col1, col2 = st.columns(2)
with col1:
st.subheader("Podcast Details")
# Podcast information
podcast_name = st.text_input("Podcast Name")
podcast_topic = st.selectbox("Primary Topic",
["Business", "Technology", "Health", "Education",
"Entertainment", "Marketing", "Self-Improvement", "Other"])
target_audience = st.text_input("Target Audience", placeholder="e.g., Entrepreneurs, Marketers, Developers")
# Episode preferences
episode_format = st.selectbox("Episode Format",
["Interview", "Solo", "Panel Discussion", "Q&A", "Case Study"])
episode_length = st.select_slider("Episode Length",
options=["15-30 min", "30-45 min", "45-60 min", "60+ min"])
# Content focus
content_focus = st.multiselect("Content Focus",
["Educational", "Inspirational", "Entertaining", "Controversial",
"Trend-focused", "Evergreen", "How-to", "Storytelling"])
if st.button("Generate Episode Ideas"):
with st.spinner("Generating podcast episode ideas..."):
time.sleep(2)
with col2:
st.subheader("Podcast Episode Ideas")
if podcast_topic:
# Generate episode ideas based on inputs
episode_ideas = []
# Topic-specific ideas
if podcast_topic == "Business":
episode_ideas.extend([
"The Future of Remote Work: Lessons from Companies That Got It Right",
"Bootstrapping vs VC Funding: Which Path Is Right for Your Business?",
"How to Build a Company Culture That Attracts Top Talent",
"The Art of Negotiation: Strategies That Actually Work"
])
elif podcast_topic == "Technology":
episode_ideas.extend([
"AI Ethics: Navigating the Moral Implications of Emerging Tech",
"The Metaverse Explained: What It Really Means for Businesses",
"Cybersecurity in 2023: Threats You Need to Know About",
"How No-Code Tools Are Democratizing Software Development"
])
elif podcast_topic == "Marketing":
episode_ideas.extend([
"The Death of Third-Party Cookies: What Marketers Need to Do Now",
"Content Strategy That Actually Converts: A Data-Driven Approach",
"Building a Personal Brand in the Age of Social Media",
"Podcast Marketing: How to Grow Your Audience Organically"
])
# Format-specific ideas
if episode_format == "Interview":
episode_ideas.extend([
f"Interview with a Leading {podcast_topic} Expert on [Trending Topic]",
f"Behind the Scenes: Conversation with a Successful {target_audience if target_audience else 'Industry Leader'}",
f"Lessons from Failure: Candid Conversation with a {podcast_topic} Entrepreneur"
])
elif episode_format == "Solo":
episode_ideas.extend([
f"My Top 5 Lessons from Building a {podcast_topic} Business",
f"The Complete Guide to [Key Concept] for {target_audience if target_audience else 'Beginners'}",
f"Debunking Common Myths About {podcast_topic}"
])
# Display episode ideas
st.write("### Generated Episode Ideas")
for i, idea in enumerate(episode_ideas):
st.markdown(f'', unsafe_allow_html=True)
st.write(f"**Episode {i+1}**: {idea}")
st.write(f"*Format*: {episode_format} | *Length*: {episode_length}")
st.markdown('
', unsafe_allow_html=True)
# Guest suggestions
if episode_format in ["Interview", "Panel Discussion"]:
st.subheader("Potential Guest Suggestions")
guest_types = [
f"Industry thought leader in {podcast_topic}",
f"Successful {target_audience if target_audience else 'professional'} with a compelling story",
f"Author of a recent book on {podcast_topic}",
f"Founder of a company solving an interesting problem in {podcast_topic}"
]
for guest_type in guest_types:
st.write(f"• {guest_type}")
# Content calendar
st.subheader("Content Calendar Suggestions")
weeks = ["Week 1", "Week 2", "Week 3", "Week 4"]
suggested_episodes = random.sample(episode_ideas, min(4, len(episode_ideas)))
for week, episode in zip(weeks, suggested_episodes):
st.write(f"**{week}**: {episode}")
else:
st.info("Enter podcast details to generate episode ideas")
# AI SEO Backlink Opportunity Finder
elif page == "AI SEO Backlink Opportunity Finder":
st.title("AI SEO Backlink Opportunity Finder")
col1, col2 = st.columns(2)
with col1:
st.subheader("Website Analysis")
# Website information
website_url = st.text_input("Website URL")
industry = st.selectbox("Industry",
["Technology", "Finance", "Healthcare", "Education",
"E-commerce", "SaaS", "Travel", "Other"])
# Current backlink profile
current_da = st.slider("Current Domain Authority", 1, 100, 35, 1)
current_backlinks = st.number_input("Current Number of Backlinks", min_value=0, max_value=10000, value=150, step=10)
# Target metrics
target_da = st.slider("Target Domain Authority", 1, 100, 50, 1)
target_backlinks = st.number_input("Target Number of Backlinks", min_value=0, max_value=10000, value=500, step=10)
if st.button("Find Backlink Opportunities"):
with st.spinner("Analyzing backlink opportunities..."):
time.sleep(3)
with col2:
st.subheader("Backlink Opportunities")
if website_url:
# Simulated opportunity data
opportunity_types = ["Guest Posting", "Resource Pages", "Broken Link Building",
"Digital PR", "Expert Roundups", "Local Citations"]
opportunity_difficulty = ["Easy", "Medium", "Hard"]
opportunities = []
for opp_type in opportunity_types:
opportunities.append({
"Type": opp_type,
"Difficulty": random.choice(opportunity_difficulty),
"Potential Links": random.randint(5, 50),
"DA Boost": random.randint(1, 5)
})
# Display opportunities
st.write("### Recommended Strategies")
for opp in opportunities:
difficulty_color = "green" if opp["Difficulty"] == "Easy" else "orange" if opp["Difficulty"] == "Medium" else "red"
st.markdown(f'', unsafe_allow_html=True)
st.write(f"**{opp['Type']}**")
st.write(f"Difficulty: :{difficulty_color}[{opp['Difficulty']}]")
st.write(f"Potential Links: {opp['Potential Links']}")
st.write(f"Estimated DA Boost: +{opp['DA Boost']}")
st.markdown('
', unsafe_allow_html=True)
# Domain authority projection
st.subheader("Domain Authority Projection")
months = list(range(1, 13))
da_scores = [current_da + (target_da - current_da) * (i/12) * random.uniform(0.8, 1.2) for i in range(12)]
fig = go.Figure()
fig.add_trace(go.Scatter(x=months, y=da_scores, mode='lines+markers',
line=dict(color='#1f77b4', width=3)))
fig.add_hline(y=target_da, line_dash="dash", annotation_text="Target DA",
annotation_position="bottom right")
fig.update_layout(title='Domain Authority Growth Projection', height=400,
xaxis_title='Months', yaxis_title='Domain Authority')
st.plotly_chart(fig, use_container_width=True)
# Outreach suggestions
st.subheader("Outreach Suggestions")
outreach_tips = [
"Personalize each outreach email with specific compliments about the target site",
"Focus on building relationships rather than just asking for links",
"Offer value first - share their content before asking for anything in return",
"Create high-quality content that's naturally link-worthy",
"Follow up politely but don't spam"
]
for tip in outreach_tips:
st.write(f"• {tip}")
else:
st.info("Enter your website URL to find backlink opportunities")
# AI Content Virality Predictor
elif page == "AI Content Virality Predictor":
st.title("AI Content Virality Predictor")
col1, col2 = st.columns(2)
with col1:
st.subheader("Content Analysis")
# Content details
content_title = st.text_input("Content Title")
content_type = st.selectbox("Content Type",
["Blog Post", "Video", "Infographic", "Social Media Post", "Podcast"])
primary_topic = st.text_input("Primary Topic")
# Content attributes
emotional_appeal = st.select_slider("Emotional Appeal",
options=["Low", "Medium", "High"])
practical_value = st.select_slider("Practical Value",
options=["Low", "Medium", "High"])
novelty = st.select_slider("Novelty/Uniqueness",
options=["Low", "Medium", "High"])
# Audience factors
target_audience_size = st.select_slider("Target Audience Size",
options=["Niche", "Medium", "Large", "Mass"])
audience_engagement = st.select_slider("Audience Engagement Level",
options=["Low", "Medium", "High"])
if st.button("Predict Virality"):
with st.spinner("Analyzing content virality potential..."):
time.sleep(2)
with col2:
st.subheader("Virality Prediction")
if content_title:
# Calculate virality score based on inputs
score_factors = {
"Emotional Appeal": {"Low": 0.3, "Medium": 0.7, "High": 1.0},
"Practical Value": {"Low": 0.3, "Medium": 0.6, "High": 0.9},
"Novelty": {"Low": 0.2, "Medium": 0.5, "High": 1.0},
"Audience Size": {"Niche": 0.3, "Medium": 0.6, "Large": 0.8, "Mass": 1.0},
"Engagement": {"Low": 0.3, "Medium": 0.7, "High": 1.0}
}
virality_score = (
score_factors["Emotional Appeal"][emotional_appeal] *
score_factors["Practical Value"][practical_value] *
score_factors["Novelty"][novelty] *
score_factors["Audience Size"][target_audience_size] *
score_factors["Engagement"][audience_engagement] * 100
)
st.metric("Virality Score", f"{virality_score:.1f}/100")
# Virality probability
if virality_score > 70:
virality_chance = "High"
color = "green"
elif virality_score > 40:
virality_chance = "Medium"
color = "orange"
else:
virality_chance = "Low"
color = "red"
st.metric("Virality Probability", virality_chance)
# Improvement suggestions
st.subheader("Improvement Suggestions")
suggestions = []
if emotional_appeal != "High":
suggestions.append("Increase emotional appeal with storytelling or provocative questions")
if practical_value != "High":
suggestions.append("Add practical tips, how-to steps, or actionable advice")
if novelty != "High":
suggestions.append("Find a unique angle or present common knowledge in a new way")
if target_audience_size == "Niche":
suggestions.append("Consider broadening the appeal without losing core message")
if audience_engagement == "Low":
suggestions.append("Include interactive elements or questions to engage audience")
for suggestion in suggestions:
st.markdown(f'', unsafe_allow_html=True)
st.write(f"💡 {suggestion}")
st.markdown('
', unsafe_allow_html=True)
# Similar viral content
st.subheader("Similar Viral Content Examples")
viral_examples = [
"How [Topic] Changed Everything: A Personal Story",
"The Ultimate Guide to [Topic] That Nobody Tells You",
"5 [Topic] Mistakes Everyone Makes and How to Avoid Them",
"Why [Topic] Is Not What You Think: The Truth Revealed"
]
for example in viral_examples:
st.write(f"• {example}")
# Distribution strategy
st.subheader("Recommended Distribution Strategy")
distribution_channels = []
if content_type == "Blog Post":
distribution_channels.extend(["Medium", "LinkedIn Pulse", "Email Newsletter", "Twitter Thread"])
elif content_type == "Video":
distribution_channels.extend(["YouTube", "TikTok", "Instagram Reels", "Facebook"])
elif content_type == "Social Media Post":
distribution_channels.extend(["Instagram", "Twitter", "Facebook", "Pinterest"])
st.write("**Primary Channels**: " + ", ".join(distribution_channels[:2]))
st.write("**Secondary Channels**: " + ", ".join(distribution_channels[2:]))
else:
st.info("Enter content details to predict virality potential")
# AI Marketing Campaign ROI Simulator
elif page == "AI Marketing Campaign ROI Simulator":
st.title("AI Marketing Campaign ROI Simulator")
col1, col2 = st.columns(2)
with col1:
st.subheader("Campaign Parameters")
# Campaign details
campaign_name = st.text_input("Campaign Name")
campaign_type = st.selectbox("Campaign Type",
["Email", "Social Media", "Content", "PPC", "Influencer", "Video"])
campaign_duration = st.slider("Campaign Duration (weeks)", 1, 12, 4, 1)
# Budget inputs
ad_spend = st.number_input("Ad Spend ($)", min_value=0, max_value=100000, value=5000, step=500)
production_costs = st.number_input("Production Costs ($)", min_value=0, max_value=50000, value=2000, step=500)
other_costs = st.number_input("Other Costs ($)", min_value=0, max_value=50000, value=1000, step=500)
# Performance assumptions
expected_reach = st.number_input("Expected Reach", min_value=1000, max_value=10000000, value=50000, step=1000)
conversion_rate = st.slider("Expected Conversion Rate (%)", 0.1, 20.0, 3.0, 0.1)
average_order_value = st.number_input("Average Order Value ($)", min_value=10, max_value=1000, value=85, step=5)
customer_lifetime_value = st.number_input("Customer Lifetime Value ($)", min_value=0, max_value=10000, value=450, step=50)
if st.button("Simulate Campaign ROI"):
with st.spinner("Running campaign simulation..."):
time.sleep(2)
with col2:
st.subheader("Campaign ROI Simulation")
if campaign_name:
# Calculate campaign metrics
total_investment = ad_spend + production_costs + other_costs
expected_conversions = expected_reach * (conversion_rate / 100)
immediate_revenue = expected_conversions * average_order_value
ltv_revenue = expected_conversions * customer_lifetime_value
immediate_roi = ((immediate_revenue - total_investment) / total_investment) * 100
ltv_roi = ((ltv_revenue - total_investment) / total_investment) * 100
# Display results
st.metric("Total Investment", f"${total_investment:,.2f}")
st.metric("Immediate Revenue", f"${immediate_revenue:,.2f}")
st.metric("Lifetime Revenue", f"${ltv_revenue:,.2f}")
st.metric("Immediate ROI", f"{immediate_roi:.1f}%")
st.metric("Lifetime ROI", f"{ltv_roi:.1f}%")
# Break-even analysis
break_even_conversions = total_investment / average_order_value
break_even_reach = break_even_conversions / (conversion_rate / 100)
st.metric("Break-even Conversions", f"{break_even_conversions:.0f}")
st.metric("Break-even Reach", f"{break_even_reach:,.0f}")
# Sensitivity analysis
st.subheader("Sensitivity Analysis")
conversion_rates = [conversion_rate * 0.7, conversion_rate, conversion_rate * 1.3]
scenarios = ["Pessimistic", "Expected", "Optimistic"]
roi_values = []
for rate in conversion_rates:
conversions = expected_reach * (rate / 100)
revenue = conversions * average_order_value
roi = ((revenue - total_investment) / total_investment) * 100
roi_values.append(roi)
fig = go.Figure()
fig.add_trace(go.Bar(
x=scenarios,
y=roi_values,
marker_color=['#d62728', '#ff7f0e', '#2ca02c']
))
fig.update_layout(title='ROI by Conversion Rate Scenario', height=400)
st.plotly_chart(fig, use_container_width=True)
# Recommendations
st.subheader("Campaign Recommendations")
if immediate_roi < 0:
st.markdown('', unsafe_allow_html=True)
st.write("⚠️ **Campaign Not Profitable**:")
st.write("- Improve conversion rate through better targeting")
st.write("- Reduce acquisition costs through different channels")
st.write("- Increase average order value with bundling or upsells")
st.markdown('
', unsafe_allow_html=True)
else:
st.markdown('', unsafe_allow_html=True)
st.write("✅ **Campaign Profitable**:")
st.write("- Consider scaling successful elements")
st.write("- Test different audience segments")
st.write("- Optimize based on initial results")
st.markdown('
', unsafe_allow_html=True)
else:
st.info("Enter campaign details to simulate ROI")
# AI Smart Customer Persona Builder
elif page == "AI Smart Customer Persona Builder":
st.title("AI Smart Customer Persona Builder")
col1, col2 = st.columns(2)
with col1:
st.subheader("Business Information")
# Business details
business_name = st.text_input("Business Name")
industry = st.selectbox("Industry",
["Technology", "Finance", "Healthcare", "Education",
"E-commerce", "SaaS", "Retail", "Other"])
product_type = st.text_input("Product/Service Type")
# Target market
target_market = st.selectbox("Target Market",
["B2B", "B2C", "Both"])
if target_market == "B2B":
company_size = st.selectbox("Target Company Size",
["Startup", "Small Business", "Medium Business", "Enterprise"])
decision_maker = st.text_input("Decision Maker Role", placeholder="e.g., Marketing Director, CEO")
else:
demographics = st.multiselect("Target Demographics",
["Age", "Gender", "Income", "Education", "Location", "Interests"])
# Customer goals and pain points
customer_goals = st.text_area("Customer Goals", placeholder="What are your customers trying to achieve?")
pain_points = st.text_area("Pain Points", placeholder="What problems do your customers face?")
if st.button("Generate Customer Persona"):
with st.spinner("Building your customer persona..."):
time.sleep(2)
with col2:
st.subheader("Customer Persona")
if business_name and product_type:
# Generate persona based on inputs
st.markdown(f'', unsafe_allow_html=True)
st.write("### 📋 Basic Information")
if target_market == "B2B":
st.write(f"**Company**: {company_size} business")
st.write(f"**Role**: {decision_maker if decision_maker else 'Decision Maker'}")
st.write(f"**Industry**: {industry}")
else:
st.write("**Demographics**: " + ", ".join(demographics) if demographics else "Various demographics")
st.markdown('
', unsafe_allow_html=True)
st.markdown(f'', unsafe_allow_html=True)
st.write("### 🎯 Goals & Objectives")
st.write(customer_goals if customer_goals else f"Solve {industry} problems efficiently")
st.markdown('
', unsafe_allow_html=True)
st.markdown(f'', unsafe_allow_html=True)
st.write("### 😫 Pain Points & Challenges")
st.write(pain_points if pain_points else f"Struggling with {industry}-specific challenges")
st.markdown('
', unsafe_allow_html=True)
st.markdown(f'', unsafe_allow_html=True)
st.write("### 💡 Solution Needs")
st.write(f"Looking for {product_type} that addresses their specific needs in the {industry} industry")
st.markdown('
', unsafe_allow_html=True)
st.markdown(f'', unsafe_allow_html=True)
st.write("### 📊 Behavior Patterns")
behaviors = [
f"Researches {product_type} solutions online",
"Seeks recommendations from industry peers",
"Compares multiple options before deciding",
"Values case studies and social proof"
]
for behavior in behaviors:
st.write(f"• {behavior}")
st.markdown('
', unsafe_allow_html=True)
st.markdown(f'', unsafe_allow_html=True)
st.write("### 📝 Marketing Message")
message = f"Our {product_type} helps {target_market.lower()} businesses in the {industry} industry {customer_goals.lower() if customer_goals else 'solve critical problems'} by addressing {pain_points.lower() if pain_points else 'key challenges'}."
st.write(message)
st.markdown('
', unsafe_allow_html=True)
# Download persona
persona_text = f"""
Customer Persona for {business_name}
Basic Information:
- Target: {target_market}
- {f'Company Size: {company_size}' if target_market == 'B2B' else f'Demographics: {", ".join(demographics) if demographics else "Various"}'}
- Industry: {industry}
Goals & Objectives:
{customer_goals if customer_goals else f"Solve {industry} problems efficiently"}
Pain Points & Challenges:
{pain_points if pain_points else f"Struggling with {industry}-specific challenges"}
Solution Needs:
Looking for {product_type} that addresses their specific needs
Behavior Patterns:
{chr(10).join([f"- {behavior}" for behavior in behaviors])}
Marketing Message:
{message}
"""
st.download_button(
label="Download Persona",
data=persona_text,
file_name=f"customer_persona_{business_name.lower().replace(' ', '_')}.txt",
mime="text/plain"
)
else:
st.info("Enter business details to generate a customer persona")
# How to Run the Application
st.sidebar.markdown("---")
st.sidebar.info("""
**How to Run This App**:
1. Save this code as `marketing_dashboard.py`
2. Install requirements: `pip install streamlit pandas numpy matplotlib plotly pillow`
3. Run: `streamlit run marketing_dashboard.py`
""")
Comments
Post a Comment