Help Articles

Site & Event Tracking

Site tracking

With site tracking you can place a small snippet of javascript on your site (similar to Google Analytics) and we will log/track all of your site traffic.  You can selectively include an email address as part of the javascript (on form completion pages, shopping carts, when users are logged in, etc..) and we will relate all of their past & future traffic on your site to that email address.

How to setup site tracking:

  1. Go to the “Apps” tab and click “Site & Event Tracking” in the side menu
  2. Click “Enable” by the “Site Tracking” section
  3. Add your domain(s) to the domain white list
  4. Copy/paste the tracking code on to your web site

Example code that you paste on your site:

<script type=”text/javascript”>
var trackcmp_email = ‘email@domain.com‘;
var trackcmp = document.createElement(“script”);
trackcmp.async = true;
trackcmp.type = ‘text/javascript';
trackcmp.src = ‘//trackcmp.net/visit?actid=279033&e=’+trackcmp_email +’&r=’+encodeURIComponent(document.referrer)+’&u=’+encodeURIComponent(window.location.href);
var trackcmp_s = document.getElementsByTagName(“script”);
if (trackcmp_s.length) {
trackcmp_s[0].parentNode.appendChild(trackcmp);
} else {
var trackcmp_h = document.getElementsByTagName(“head”);
trackcmp_h.length && trackcmp_h[0].appendChild(trackcmp);
}
</script>

How to use your site traffic data:

  • Automated series
  • Segments
  • Personalization
  • Conditional content

NOTE: We automatically track site visits as soon as you install the code on your site, activate site tracking from your account, and whitelist the tracked domains. In order for us to match the site visits, one of the following needs to happen.

  1. The contact would need to subscribe through an ActiveCampaign form
  2. The contact clicks a campaign link that takes them to a tracked page

 

Event tracking

With event tracking you can log events such as sign ups, orders, actions within your application, etc… With each event that you log you can specify the email address, an event name, and an event value.  The event name and value can be anything you want.  You can then use event data to help run automations, personalize campaigns, show conditional content, trigger campaigns, etc..

How to setup event tracking:

  1. Go to the “Apps” tab and click “Site & Event Tracking” in the side menu
  2. Click “Enable” by the “Event Tracking” section
  3. Copy/paste the event tracking code on to your web site
  4. Be sure to update the event name and event data variables in the tracking code

Example code that you paste on your site:

$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);
}

How to use your site traffic data:

  • Automated series
  • Segments
  • Personalization
  • Conditional content