An overview of Event Tracking

Event Tracking allows you to collect data on a wide variety of contact behavior. You can create an event for any activity on your website or app and assign that behavior a value. You can use this data to improve your marketing and sales processes. It gives you additional data to use to trigger automations, segment your contacts, and personalize campaigns.

Site Tracking versus Event Tracking:

Site Tracking collects page view data. So Site Tracking would tell you a contact visited a web page. Site Tracking is a snippet of code that gets pasted into every page of your site. Learn more about Site Tracking here.

With Event Tracking, you are able to track more than just page views. You could track video views, button clicks, orders, log ins, and in-app behavior. You can configure Event Tracking to track almost anything. Event Tracking is more flexible, but it is also more challenging to set up because you'll need to customize the code for each event.

Setting up Event Tracking:

To set up Event Tracking you'll need to be familiar with programming, or you could hire someone familiar with programming. It's relatively quick and easy to set up for a programmer so it shouldn't be expensive to have someone set it up for you. You may want to hire an ActiveCampaign Certified Consultant. Many of them can help you set up Event Tracking and fit it into a larger strategy for growing your business.

Turning Event Tracking on:

Click your avatar in the upper-right hand corner:



Click “My Settings” in the menu that appears.

Click “Tracking” in the left-hand sidebar menu: 



Click the red button to toggle Event Tracking to the “On” state:



Add events by typing their name into the text box and clicking “Add:”



After you've added your events, you can reference them in the segment builder. This is a way to refer to events before they've occurred. But note that Event Tracking will automatically add events as they happen — it is not necessary to add them here first.

Event Tracking example code:

The code you use will vary depending on the event you are tracking and other factors. To generate example code you can use as a starting point. Click the “Event Tracking API” link:



This will give you code that includes your account ID and key:

 

An Event can be triggered by using POST to send data to http://trackcmp.net/event. This can be done in virtually any programming language. Below is an example of how this could be done using PHP.


$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://trackcmp.net/event");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, array(
"actid" => 23033,
"key" => "c12973b078007927842301eff932e7d78b74b3e",
"event" => "YOUR_EVENT",
"eventdata" => "ANY_DATA",
"visit" => json_encode(array(
// If you have an email address, assign it here.
"email" => "",
)),
));

$result = curl_exec($curl);
if ($result !== false) {
$result = json_decode($result);
if ($result->success) {
echo 'Success! ';
} else {
echo 'Error! ';
}

echo $result->message;
} else {
echo 'CURL failed to run: ', curl_error($curl);
}

 

Event Tracking with our PHP API wrapper:

You can also accomplish this using our ActiveCampaign PHP API Wrapper.

Have more questions? Submit a request