Analytics hooks
CampaignSuite sends analytics events for entries and payments. An entry event is named cs_{type}_{action}, for example cs_payment_executed. It is sent once, after the entry has been saved successfully, so analytics never reports a state that wasn’t stored. Errors while sending are logged and never interrupt the request.
With the hooks below you can block an event, or change the data of an entry event before it goes out.
cs_send_analytics_event
Section titled “cs_send_analytics_event”Filter · includes/class-campaignsuite.php
Decides whether an analytics event is sent. Return false to skip the event, for example to stop all analytics on a staging site or for test entries. It runs for every event sent through CampaignSuite::send_analytics_event(), entry events included.
| Parameter | Type | Description |
|---|---|---|
$should_send |
bool |
Whether to send the event. Default: true. |
$event_name |
string |
The event name, for example cs_payment_executed. |
$event_data |
array |
The data of the event, after the entry analytics filters. |
$unique_id |
string|null |
A unique ID for the event, or null. For entries this is {client result ID}_{action}. |
$timestamp |
string|null |
The event date as ISO 8601, for example 2026-11-03T17:24:42+01:00, or null. |
Returns: bool — false to skip the event.
add_filter('cs_send_analytics_event', function ($should_send, $event_name, $event_data, $unique_id, $timestamp) { if (wp_get_environment_type() !== 'production') { return false; }
return $should_send;}, 10, 5);cs_entry_execute_analytics_data_{client}
Section titled “cs_entry_execute_analytics_data_{client}”Filter · includes/post-types/class-entry.php
Filters the data of an entry analytics event, for the entries of one client. The dynamic part {client} is the client of the entry, for example cs_entry_execute_analytics_data_salesforce. It runs before cs_entry_execute_analytics_data.
| Parameter | Type | Description |
|---|---|---|
$event_data |
array |
The event data: the type, source, client, is_debug and external_campaign_id of the entry, a client_id (the ID the client returned) and, for payments, the amount, currency, method, frequency, payment type and status. |
$entry |
Entry |
The entry the event is about. |
Returns: array — the event data.
add_filter('cs_entry_execute_analytics_data_salesforce', function ($event_data, $entry) { $event_data['website'] = home_url();
return $event_data;}, 10, 2);cs_entry_execute_analytics_data
Section titled “cs_entry_execute_analytics_data”Filter · includes/post-types/class-entry.php
Filters the data of every entry analytics event, whatever the client. It runs after cs_entry_execute_analytics_data_{client}.
| Parameter | Type | Description |
|---|---|---|
$event_data |
array |
The event data, as described for cs_entry_execute_analytics_data_{client}. |
$entry |
Entry |
The entry the event is about. |
Returns: array — the event data.
add_filter('cs_entry_execute_analytics_data', function ($event_data, $entry) { unset($event_data['external_campaign_id']);
return $event_data;}, 10, 2);