Advanced Website Tracking with Infusionsoft

Note: This post was archived from the Infusionsoft Blog. More details here.

First, I want to thank everyone who attended the Einstein Track of InfusionCon. We had a ton of fun and learned a lot.  It was great to be with so many entrepreneurs who are excited and positive about the future (despite the doom and gloom out there – see my next post on that topic).

During InfusionCon I shared some cool ways to bend Infusionsoft into a pretzel and get it to do some stuff that you’ve always wanted it to do.  I also said I’d share the details here on the blog.  It’s taken a bit to pull together, but I know you all were thirsting for code examples. Consider this a kind gesture to all those who attended my sessions at InfusionCon. Here we go!

WARNING: This is going to get very technical. So, unless you can hack your way through some PHP, the Infusionsoft API, and some other mind-bending tricks, you might want to grab your Web guy or gal. Seriously though, if you don’t know what you’re doing, you could mess up your Web site. I’ve done my best to demonstrate the best ways to extend your Infusionsoft experience, but please test these techniques to ensure your application works to your needs.

ADVANCED WEBSITE TRAFFIC TRACKING

I’ve always wanted to be able to track people’s activity on our website directly into the contact record.  A few months back, I was hanging out with Brad Martineau in one of the many cities we traveled to last year and the solution just “arrived” in my brain.  I think it was Brad’s presence that brought the inspiration. (He’s the product designer, good ideas just seem to attract to him.)

Here’s what you need to know:

Checkboxes are not associated with the Web Forms within which they are created. What?

Ok, let me explain.  When you create a Web Form, you can add checkboxes to that Web Form.  Each checkbox has its own set of actions that run separately from the actions tied to the web form.  But, its important to understand that its not required for a checkbox to be in the web form in which it was originally created, AND its not necessary for the checkbox to be a checkbox — it can be a hidden field, AND the name doesn’t matter — only the value (so a checkbox with the name Checkbox0 could be changed to Checkbox1 with no effect as long as the value is the same).

This is the core of understanding how to track prospects’ activity on your Web site. It’s OK, you can re-read that a few times to make sure you got it clearly.

Here’s how you do it:
Go create a Web Form and call it “Website Tracking” or any other name you want.  Ignore the required fields, you won’t use them.  Add a checkbox for every important page of your site.  Don’t worry about all the miscellaneous pages.  What you really want to know is whether or not a person has visited key pages of your site, and if so, which ones.  Once you’ve created the checkboxes for each page, edit the actions for each checkbox. You can utilize any of Infusionsoft’s actions, but for simple tracking, we’re going to just add a tag.  For example, if I create a checkbox that represents the “Demo” page of our site, I would add an action that adds a tag “VISITED: Demo”.  That way, if someone ends up with that tag in their record, I can easily see that the person visited the demo page.

Ok, here’s where its going to get technical. Now that you have your checkboxes all set up, write down the id’s of each of checkbox.  Its easiest to just look at the HTML code that Infusionsoft gives you for that form and check out the list of checkboxes and their values.  Write the values down.  Make sure you know which page each ID is associated with.  Now, what you’re going to do is create a cookie whose value is a comma-separated list of the checkbox IDs of the pages that have been visited.  So, on each of these key pages you’ll need to run a script that checks to see if the cookie exists, if not, it needs to create the cookie and add the value of the ID of the checkbox that represents that page.  If it does exist, you’ll need to read the values and check to see if the ID is already in the cookie, if not, add it.

Next, any time there is an Infusionsoft form on your site, you’ll need to read the cookie value, split it into an array, cycle through the array and for each value (each checkbox ID) you create a hidden field “Checkbox” field and insert the value (checkbox id).  Then when someone fills out the form – magically, they get tagged for each of the key pages they visited.  You can also increase their lead score for each page they visit (but you’ll have to read the next part to find out how to do lead scoring).

Hint: If you’re using a content management system (like Joomla or WordPress), this gets easier because you can tie the ID of a content item to the ID of the checkbox and run the cookie stuff in the template.

I’m sure by now you’re probably confused and saying, “Just give me the code please.” Don’t fret,  I got you covered. 🙂

We use Joomla on our site so, here’s the PHP code we use in the Joomla template.  The case is the Joomla page id.  So in the example below, case 379 might represent the content id for our Demo page and 7772 is the id of the checkbox inside Infusionsoft that I have set to give the tag,  “VISITED: Demo”:

// SET COOKIE FOR PAGE VISITS
switch($_REQUEST['id']){
case 379:
$page = "7772";
break;
case 429:
$page = "7774";
break;
case 430:
$page = "7776";
break;
case 431:
$page = "7778";
break;
case 432:
$page = "7780";
break;
case 434:
$page = "7782";
break;
case 435:
$page = "7784";
break;
case 428:
$page = "7798";
break;
}
 $visits = array();
if ($_COOKIE['visits']) {
$visits = split(",",$_COOKIE['visits']);
}
if (!in_array($page, $visits)) array_push($visits, $page);
$vnum = count($visits);
$i = 0;
while ($i < $vnum) {
$visitstotal .= $visits[$i];
$i++;
if ($i < $vnum) $visitstotal .= ",";
}
setcookie("visits", $visitstotal,time()+100000000, "/", $domain);

Once you have that code running on your site, you now need to read the cookie and dump it the hidden checkboxes into your form.  Here’s the code:

$visits = split(",",$visitstotal);
$vi = 1;
foreach($visits as $visit) {
echo "<input type='hidden' name='Checkbox".$vi."' value='".$visit."'>n";
$vi++;
}

Make sense?  I’m not a programmer, so I’m sure someone will find problems with my code.  Feel free to suggest ways to improve it in the comments below.

Taking it to the next level
If you’re really advanced, you could set a cookie with the contact Id once a visitor fills out the form (use the web form feature “Pass Person’s info to ‘Thank You’ page url”, then, on the thank you page, create the cookie).  Once you have a cookie that ties the web site visitor to a contact record in Infusionsoft, you could have an API script running on all pages of your site that tracks EVERY move they make  – you could capture this data by tagging the visitors, by counting pageviews, by storing history in the contact notes (date & time stamp of when they visited), start follow-up sequences once they visited a certain number of pages, send a voice broadcast once they visit a critical page, etc.  The options are limitless.

Learning more about your prospects is the purpose of integrating these pieces of data with Infusionsoft. Perhaps someone only looked at a demo video, maybe they glanced at your management team or became interested in your guarantee. In a future blog entry, I’ll share how to score leads with this data. Infusionsoft does lead scoring? Yeah. 😉

Let me know if you have questions or suggestions with how to track prospects on your Website.

Tyler

9 thoughts on “Advanced Website Tracking with Infusionsoft”

  1. Tyler – I cannot tell you how many people have been screaming for this! Thanks for laying it out, step by step.

    Implementing these techniques will certainly help people double their sales.

  2. Tyler…you are amazing my friend. There are so many “gurus” out there today who from time to time, share their “secrets.” Usually this involves concept delivery and lacks the “nitty-gritty” to really replicate their success. With complete authenticity, and transparency you just give this pimp code to the world – for free, with no personal agenda or anything to gain.

    I’m taking the code and running just in case you change your mind and decide to pull it down. Who could blame you?

    Thanks again,

    Jarrod Morris
    http://integrity-safe.com

  3. This is great. I really need an Infusion tracking script like this for html and htm pages. Can you provide me with that? I see the script for php pages but not for html or htm pages.

    Please let me know.

  4. This is great. I really need an Infusion tracking script like this for html and htm pages. Can you provide me with that? I see the script for php pages but not for html or htm pages.

    Please let me know.

  5. Pingback: Low Cost Advanced Website Traffic Tactics For Everyone | Digital Download Stampede.com

  6. So, if you speak some German you’ll be fine in Austria – try it out
    on your transfers from Salzburg airport to get you started.

    Copyright (c) 2012 Alpes Executive Transfers – Article Source: many
    years of experience in providing services to Dobson Mark the owner of Executive Alpes are the first choice when it comes to all forms of private transportation in the
    Alpes and surrounding French & Swiss regions. Public transportation- If you have planned to travel in public transportation, keep the details
    of their pick-up times and locations, hours of
    service, and the schedules handy.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.