may I ask how to track the specific event with the event tracking ActiveCampaign code?` For example, if I want to track button clicks on my own website, how do I add on in this php sample code here.
Thank you.
<?php
// initializes a cURL session
$curl = curl_init();
// changes the cURL session behavior with options
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" => "Actid",
"key" => "Key",
"event" => "EVENT NAME",
"eventdata" => "Button click login",
"visit" => json_encode(array(
// If you have an email address, assign it here.
"email" => "",
)),
));
//execute
$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);
}
};
?>`
You will have to use AJAX and send a request to execute this segment of code on all the buttons you want to track the click event.