Skip to content

Repository files navigation

Подсчёт конверсий через базу данных.py

Скрипт не принимает excel файлы и работает напрямую с БД. Посчитает конверсии и статусы клиентов (новый, с колёс и т.д.), а также предоставит информацию о первых и последних покупках.

Customer Conversion Analysis

Python tool for analyzing customer conversion from leads and communications into purchases using SQL data.

Description

This project analyzes customer conversion by combining sales data, call history and CRM leads.

The script calculates how effectively customer communications are converted into real purchases and provides metrics for evaluating sales channels.

The analysis is based on SQL database records and automatically generates a structured Excel report.

Business Goal

The main objective is to evaluate customer acquisition efficiency and understand which communication channels generate real sales.

The report helps analyze:

  • lead-to-sale conversion
  • new and returning customers
  • customer acquisition channels
  • sales performance by location

Features

  • SQL database connection
  • Loading data from multiple sources
  • Sales history analysis
  • CRM leads processing
  • Phone number cleaning and normalization
  • Customer matching by phone numbers
  • New vs returning customer classification
  • Lead-to-sale conversion calculation
  • Location-based performance analysis
  • Excel report generation
  • Telegram execution notifications

Tech Stack

  • Python
  • pandas
  • SQLAlchemy
  • MySQL Connector
  • pyTelegramBotAPI
  • tqdm
  • openpyxl

How It Works

  1. Loads sales, calls and CRM data from SQL database
  2. Cleans and standardizes customer phone numbers
  3. Matches customers between different data sources
  4. Defines customer acquisition source:
    • direct visit
    • phone call
    • CRM request
  5. Identifies new and returning customers
  6. Calculates conversion metrics
  7. Generates Excel report with detailed analytics
  8. Sends Telegram notification after execution

Example / Demo

Input

  • Sales database
  • Call history
  • CRM leads
  • Customer directory

Output

Generated Excel report containing:

  • Total customers
  • New customers
  • Leads count
  • Unique leads
  • Lead-to-sale conversion
  • Conversion by business unit
  • Conversion by location

Use Case

This project can be used for:

  • sales analytics
  • CRM analytics
  • marketing performance analysis
  • customer acquisition optimization

About

Скрипт не принимает excel файлы и работает напрямую с БД. Посчитает конверсии и статусы клиентов (новый, с колёс и т.д.), а также предоставит информацию о первых и последних покупках.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages