Skip to content

A tool for Klaviyo users to reduce costs by identifying and deleting inactive profiles in transactional lists while retaining active marketing profiles. Includes deduplication and safe deletion with real-time updates, helping you optimize active profiles and manage your Klaviyo account efficiently.

Notifications You must be signed in to change notification settings

davedavis/Klaviyo_Profile_Deleter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Klaviyo Profile De-Duplication and Deletion Utility

Overview

Klaviyo charges customers based on the number of active profiles, which can add up quickly. Often, email marketers use Klaviyo for transactional emails that require a user to be subscribed to a list, but once the initial transaction completes, there may be no need to keep these profiles. This utility app helps remove unnecessary profiles from Klaviyo lists, keeping only those profiles actively engaged in your marketing efforts and reducing your active profile count.

This app consists of two parts:

  1. dedupe.py – Identifies profiles present in transactional (master) lists but absent from marketing (opt-in) lists.
  2. main.py – Deletes profiles found by dedupe.py from Klaviyo to manage active profiles more efficiently.

Getting Started

Prerequisites

  • Python 3.x installed on your system
  • A Klaviyo API key (with permissions to access and delete profiles)
  • List IDs for both your transactional and marketing lists

Setup Guide

  1. Clone this repository and navigate to the project directory:

    git clone <repository-url>
    cd klaviyo-dedupe-delete
  2. Install Required Libraries: Install necessary dependencies using pip:

    pip install -r requirements.txt
  3. Create a .env file:

    • In the root of the project directory, create a .env file to securely store your Klaviyo API key.
    • Add the following line to your .env file, replacing YOUR_KLAVIYO_API_KEY with your actual Klaviyo API key.
      KLAVIYO_API_KEY=YOUR_KLAVIYO_API_KEY
  4. Edit the Lists in dedupe.py: Open dedupe.py and add the list IDs for your master (transactional) and marketing (opt-in) lists:

    # List IDs
    master_lists = ["YOUR_MASTER_LIST_ID_1", "YOUR_MASTER_LIST_ID_2"]
    marketing_lists = ["YOUR_MARKETING_LIST_ID_1", "YOUR_MARKETING_LIST_ID_2", ...]

How It Works

Step 1: Identify Profiles for Deletion (dedupe.py)

  1. Purpose: dedupe.py generates a CSV with profiles in your transactional lists that are not present in your marketing lists.
  2. Usage:
    • Run dedupe.py with:
      python dedupe.py
    • This will create a CSV file named unique_master_profiles.csv in your project directory.
    • The CSV will contain profile IDs from your master lists that are not in any marketing list.

Step 2: Delete Profiles (main.py)

  1. Purpose: main.py deletes profiles from Klaviyo that are listed in the unique_master_profiles.csv file generated by dedupe.py.
  2. Usage:
    • Important: Consider working on a small subset of your unique_master_profiles.csv to ensure the deletion process works as expected.
    • Run main.py with:
      python main.py
    • The script will:
      • Process each profile ID from the CSV, initiating a deletion request with Klaviyo’s API.
      • Remove successfully deleted IDs from the CSV file after each request, allowing you to stop and resume the process safely.

Recommendations

  • Start with a Subset: Especially if this is your first time running this utility, test with a subset of profiles by creating a smaller CSV file from unique_master_profiles.csv.
  • Monitor the Script’s Output: Each successful deletion will print the profile ID to the console, while any failures will also be logged.

Notes

  • Rate Limits: Klaviyo's API allows up to 60 profile deletions per minute, so main.py includes a small delay between each request to avoid hitting rate limits.
  • Real-Time File Updates: After each profile is successfully deleted, main.py immediately removes it from the CSV, so the file always reflects the list of remaining profiles.

Troubleshooting

  • Profiles Not Deleting in Real-Time: If the CSV file does not update in real-time, ensure you are using the latest version of main.py which incorporates immediate file writing after each deletion.
  • Klaviyo API Errors: If you see errors related to missing attributes, double-check your Klaviyo API key and ensure the API key has the required permissions.

This utility is designed to help email marketers effectively manage their Klaviyo profiles, reduce unnecessary active profiles, and avoid unnecessary charges.

About

A tool for Klaviyo users to reduce costs by identifying and deleting inactive profiles in transactional lists while retaining active marketing profiles. Includes deduplication and safe deletion with real-time updates, helping you optimize active profiles and manage your Klaviyo account efficiently.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages