A/B testing for Marketing Campaign Using Python

Problem

A/B testing is also known as split testing mainly used test features like which campiagn is best, used in UX features in a website and decide whether the new feature for product is good or not.

"A/B testing is like a game of inches. The difference between a winning and losing campaign is often just a small tweak." - Neil Patel, Digital marketer and entrepreneur.The goal of A/B testing is to track the primary metric during the test period and find out whether there is a difference in the performance of the product and what type of difference is it.

To View My Project - Click here

A/B TESTING OF MARKETING CAMPAIGNS

Here we are working to understand the results of an A/B test run by an e-commerce website. So we are analysing the Kaggle Dataset (https://statso.io/a-b-testing-case-study/ ). Please fine my finding and explanantions regarding the campiagn analysis

Solution

  • pandas: Used for data manipulation.

  • datetime: Handles date-related operations.

  • plotly.graph_objects and plotly.express: Used for creating interactive visualizations.

  • plotly.io: Configures visualization settings.

  1. Data Loading:

    • Two CSV files (control_group.csv and test_group.csv) containing campaign data are loaded into Pandas DataFrames.

  2. Data Cleaning:

    • Columns in both datasets are renamed for clarity.

    • Missing values in the control data are filled with mean values for respective columns.

  3. Data Merging:

    • Control and test datasets are merged based on the date.

B. Data Analysis

  1. Campaign Strategy Analysis:

    • Number of Impressions vs. Amount Spent:

      • Scatter plot visualizes the relationship between impressions and amount spent, showing that control campaign impressions are more than test campaign impressions.

    • Add to Cart Analysis:

      • Bar graph indicates that the control campaign has more "Added to Cart" actions than the test campaign.

    • Search Analysis:

      • Horizontal bar graph shows that users searched more due to the Test Campaign than the Control Campaign.

    • Purchase Analysis:

      • Pie chart compares purchases made by the control and test campaigns, indicating a slight increase in purchases for the control campaign.

    • Website Clicks vs. Content Viewed:

      • Scatter plot illustrates that website clicks are higher in the test campaign, but engagement is higher in the control campaign.

    • Content Viewed vs. Add to Cart:

      • Scatter plot reveals that more people viewed content and added products in the control campaign.

    • Add to Cart vs. Purchases:

      • Scatter plot suggests that the conversion rate of the test campaign is higher than the control campaign.

3. Conclusion

  • Summary:

    • The control campaign has a higher conversion rate, more sales, and engagement from visitors.

    • The test campaign is effective in showcasing products and generating clicks.

  • Recommendation:

    • Suggests using the control campaign for multiple products and audiences.

    • Recommends the test campaign for marketing single products to a specific audience.