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.
Setting up Operational
- Go to https://app.operational.co and sign up for an account.
- Log in and navigate to your API Keys section.
- Create a new key and copy your API Key.
- 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.