Add tracked event (name and value) to the system (globally). Make sure to enable event tracking before making this call (events added with event tracking disabled will not be saved).
Endpoint:
https://trackcmp.net/event
HTTP method:
POST
Supported output formats:
json
Requires authentication:
Yes
Parameters:
* indicates requirement. Underlined params include in URL, otherwise as part of the post body. POST data must be formatted as
Content-Type: application/x-www-form-urlencoded
. We don't accept any other input formats like JSON.
Variable
Description
api_key*
Your API key
actid*
Your unique tracking account ID (can be found on the Integrations page)
key*
Your unique tracking event key (can be found on the Integrations page)
event*
The event name you want to add. Example: 'my_custom_event'
eventdata
The event value (related to the event name). Example: '12345'. (Note: if you don't include this parameter it will still save the event name.)
visit
See below example for the data you can include here.
Example response:
Variable
Description
success
Whether or not the request was successful. Example: 1 (successful) or 0 (not successful)
message
The response message. Example: "Event spawned"
PHP Example
This is an example of using the track_event_add call with PHP.
You can replicate the same idea in virtually any other programming language.
The example shown is using serialize as the output format.
You can change that to XML or JSON if you would like.
<?php
// Set up an object instance using our PHP API wrapper.
define("ACTIVECAMPAIGN_URL", "https://{ACCOUNT}.api-us1.com");
define("ACTIVECAMPAIGN_API_KEY", "{API_KEY}");
require_once("../activecampaign-api-php/includes/ActiveCampaign.class.php");
$ac = new ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY);
$ac->track_actid = "1111111"; // your unique tracking account ID (found on the Integrations page).
$ac->track_key = "hus7dasty..."; // your unique event key (found on the Integrations page).
$ac->track_email = "test@test.com"; // (optional) contact email address to associate the event with.
$post_data = array(
"event" => "my_custom_event",
"eventdata" => "12345",
// any extra (optional) visit data to include?
"visit" => array(
"url" => "",
"referrer" => "",
"ip4" => "",
"ip6" => "",
"ua" => "",
"browser" => "",
"platform" => "",
"device" => "",
"utm_source" => "",
"utm_campaign" => "",
"utm_medium" => "",
"utm_term" => "",
"utm_content" => "",
),
);
$response = $ac->api("tracking/log", $post_data);
echo "<pre>";
print_r($response);
echo "</pre>";
?>
<?php
// Set up an object instance using our PHP API wrapper. define("ACTIVECAMPAIGN_URL", "https://{ACCOUNT}.api-us1.com"); define("ACTIVECAMPAIGN_API_KEY", "{API_KEY}"); require_once("../activecampaign-api-php/includes/ActiveCampaign.class.php"); $ac = newActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY);
$ac->track_actid = "1111111"; // your unique tracking account ID (found on the Integrations page). $ac->track_key = "hus7dasty..."; // your unique event key (found on the Integrations page). $ac->track_email = "test@test.com"; // (optional) contact email address to associate the event with.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
Manage Consent Preferences
Performance Cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
Functional Cookies
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
Strictly Necessary Cookies
Always Active
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.
Targeting Cookies
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.