Thursday, May 8, 2025

Customer Relationship Management (CRM) - Lead Scoring Engine

 


Notes:

  • Problem Solved: Automatically scores leads based on engagement and fit, prioritizing sales follow-ups.

  • Customization Benefits: Adjust scoring logic based on your customer persona or sales cycle.

  • Further Adoption: Integrate with email systems, web tracking, or CRM platforms like Salesforce or HubSpot.

Python Code:


import pandas as pd

def score_leads(df):
    def calculate_score(row):
        score = 0
        if row['industry'] in ['tech', 'finance']: score += 20
        if row['email_opened'] > 3: score += 10
        if row['website_visits'] > 5: score += 15
        if row['demo_requested']: score += 30
        return score

    df['lead_score'] = df.apply(calculate_score, axis=1)
    return df.sort_values(by='lead_score', ascending=False)

# Example
lead_data = pd.DataFrame([
    {'name': 'Alice', 'industry': 'tech', 'email_opened': 5, 'website_visits': 7, 'demo_requested': True},
    {'name': 'Bob', 'industry': 'retail', 'email_opened': 1, 'website_visits': 2, 'demo_requested': False}
])
print(score_leads(lead_data))

No comments:

Post a Comment

IoT (Internet of Things) Automation - Smart Energy Usage Tracker

  Notes: Problem Solved: Logs and analyzes power usage from smart meters. Customization Benefits: Track per-device energy and set ale...