Track cancelled subscriptions in Wordpress

Learn to track when users cancel subscriptions in Wordpress using Operational for real-time monitoring and analysis.

What is subscription cancellation tracking in Wordpress

Tracking when users cancel subscriptions helps you understand churn and improve retention.

If someone leaves, you can capture that event and analyze why.

For example, you might log when a user cancels a recurring plan on your Wordpress site. This data guides your marketing and support.

Using Operational to track cancellations

Operational is an open-source event tracking tool.

It captures events from any tech product.

You can send cancellation events to Operational for real-time insights and dashboards.

Operational usage

Setting up Operational

  1. Go to https://app.operational.co and sign up for an account.
  2. Log in and navigate to your API Keys section.
  3. Create a new key and copy your API Key.
  4. Keep your key safe for use in your server code.

Code examples

<?php
$apiKey = "YOUR_API_KEY";
$payload = [
    "name" => "subscription cancelled",
    "avatar" => "🔄",
    "content" => "User Jane Doe cancelled subscription ID 456",
    "tags" => ["subscription", "cancelled", "wordpress"]
];
$ch = curl_init("https://api.operational.co/v1/events/ingest");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer $apiKey",
    "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
$response = curl_exec($ch);
curl_close($ch);
echo $response;

This example sends a basic subscription cancellation event.

<?php
// Include additional user data
$apiKey = "YOUR_API_KEY";
$payload = [
    "name" => "subscription cancelled",
    "avatar" => "🔄",
    "content" => "User John Smith cancelled the Pro plan subscription",
    "tags" => ["subscription", "cancelled", "wordpress"],
    "metadata" => [
        "user_id" => 789,
        "plan" => "Pro"
    ]
];
$ch = curl_init("https://api.operational.co/v1/events/ingest");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer $apiKey",
    "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
$response = curl_exec($ch);
curl_close($ch);
echo $response;

This example includes user metadata and plan details.

Conclusion

Operational helps you record cancellation events without building complex infrastructure.

You get real-time insights and can focus on improving user retention.

Learn more at https://operational.co and try code snippets in the playground at https://operational.co/playground.