Marketing Channel Attribution Models
Project description
Author: Dhivya Nagasubramanian
Purpose: The channel attribution package This versatile package provides a robust solution for handling various attribution models, giving you the flexibility to analyze and assign credit to touchpoints across the customer journey. It’s designed to cater to businesses looking to understand and optimize their marketing strategies, with powerful support for multiple attribution models.
--------------------------------------------------------------------------------------------------------------------------------------------
Key Features:
Last Touch Attribution
Assigns full credit to the last interaction before conversion, offering insights into the final trigger event in the customer journey.
First Touch Attribution Focuses on the first point of contact, helping businesses understand which marketing efforts are driving initial awareness and engagement.
Linear Attribution Distributes credit equally across all touchpoints, allowing for a holistic view of how each interaction contributes to conversions.
Time-Decay Attribution Gives more credit to touchpoints that occurred closer to the conversion, effectively capturing the influence of recent interactions.
vPosition-Based (U-Shaped) Attribution** Applies the majority of the credit to the first and last touchpoints, with the remaining credit spread across the middle interactions, emphasizing the key roles of initial engagement and conversion.
Custom Attribution (Business Rules-Based) Lets you define your own attribution rules based on specific business goals, providing the flexibility to tailor the model to unique marketing strategies.
W-Shaped Attribution Offers a more granular approach by assigning credit to three key touchpoints—first, middle, and last—highlighting the importance of each stage in the funnel.
Last-Non-Direct Click Attribution Assigns credit to the last non-direct touchpoint before conversion, ideal for understanding how indirect channels influence final decisions.
--------------------------------------------------------------------------------------------------------------------------------------------
Requirements packages:
NumPy - Adds support for large, multi-dimensional arrays, matrices and high-level mathematical functions to operate on these arrays.
python-dateutil - Provides powerful extensions to the standard datetime module.
dask - Dask is a flexible parallel computing library for analytics. See documentation for more information.
random - generate random numbers with in the set limits.
pandas - Dataframe utility.
journey-orchestrate - Journey orchestration package for building customer marketing touch point journey.
--------------------------------------------------------------------------------------------------------------------------------------------
Installation Instructions:
pip install channelattributions
--------------------------------------------------------------------------------------------------------------------------------------------
Example
| ID | Timestamp | Channel |
|-----:|:--------------------|:------------|
| 1 | 2024-11-18 08:00:00 | email |
| 1 | 2024-11-18 09:00:00 | sms |
| 3 | 2024-11-18 10:00:00 | app |
| 3 | 2024-11-18 11:00:00 | email |
| 5 | 2024-11-18 12:00:00 | sms |
| 5 | 2024-11-18 15:00:00 | direct mail |
--------------------------------------------------------------------------------------------------------------------------------------------
How to use it :
0. generate_random_data(n,nc,startdt, enddt,channel_lst,random_seed)
-
This would generate sample dataset to test the customer journey orchestrate function
1st parameter - Number of rows to generate.
2nd parameter - Number of unique IDs you want in the dataset 3rd parameter - Start date.
4th parameter - End date.
5th parameter - Unique Channel list : eg:['EM','SMC','PD','PS'].
6th parameter - random_seed.
1. last_touch(df,id_column,timestamp_column , n_partition) .
2. first_touch(df, id_column, timestamp_column, n_partition).
3. linear_attribution(df, id_column,timestamp_column, n_partitions, value).
4. time_decay_attribution(df, id_column, timestamp_column, channel, n_partitions, decay_factor).
5. position_u_shaped_attribution_dask(df, id_column, timestamp_column, channel, n_partitions , decay_factor ).
6. w_shaped_attribution_dask(df, id_column,timestamp_column, channel, n_partitions, decay_factor).
7. last_nondirect_click_attribution(df, id_column,timestamp_column, channel,direct_channel_name, n_partitions).
df - Dataframe that contains the the customer journey along with timestamp (as provided in the example above) id_column - Customer unique ID timestamp_column - Timestamp of the touch point channel - Channel (For example : Paid Display, Direct Mail, Email) n_partitions - Number of partitions the data should run (for dask implementation) decay_factor - Decay Factor attrib_value - Attribution value to be used for linear attribution decay_factor - Decay factor direct_channel_name - Channel name (for eg: Direct Mail) that are part of direct marketing.
--------------------------------------------------------------------------------------------------------------------------------------------
How to test the package without data ?
Step1 - Run with "generate_random_data" by passing appropriate values
eg: df_example = generate_random_data(1000,30,"2023-01-01','2024-10-01',['EM','Direct Mail','Paid Display','Search'],230).
Step2 - Run the respective attribution models discussed above
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file channelattributions-0.0.2.tar.gz.
File metadata
- Download URL: channelattributions-0.0.2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94988566a2059781a423c777cc7862df5a5edaa703251f66f11a8a048b0b9e46
|
|
| MD5 |
b9b979158ffb73bee67aba02ea49949a
|
|
| BLAKE2b-256 |
28fac3ba1bc7bfcb3a25748efcd5804d426ace2b5de67424f0a48393e33f89db
|
File details
Details for the file channelattributions-0.0.2-py3-none-any.whl.
File metadata
- Download URL: channelattributions-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
376e1283495168f496747d4c636cc935bb72bed664acf2008190e1347446e970
|
|
| MD5 |
755329f9fe785c55af1ab5861815a9db
|
|
| BLAKE2b-256 |
1718f0b5db433a82727c26cdf7a339ba8e8b21ba8c84122ca7b062eb66d7d76d
|