When marketing to users online, we want to be able to segment those users based on a certain set of categories as per your campaigns. If a user attended your tradeshow and then viewed your site, or a user found your company through a paid ad on Google, or a user received an email marketing blast – you want to be able to define; a) who was who, and b) which of your marketing efforts were effective in converting that user from a lead to a prospect?
One of the features in Pardot is the ability of creating lists. This can be found in the Marketing Segmentation area on the administration site. Those lists could be a set of adgroups you’ve created which categorize those users in the above example into separate groups.
The ultimate question now is who’s who and how do I determine this? There isn’t one answer to this as there is many ways of doing this. One common method is to create landing pages. Using our example example of three separate types of users, using the landing pages method, this would give us the following
yourdomain.com/marketing/tradeshow
yourdomain.com/marketing/email
yourdomain.com/marketing/search
In Pardot, you’ll want to create three lists so you can track each of these types of users. Make sure you keep the name you gave each list as we’ll be using it in the code below. For the sake of simplicity, we’ll use the page paths above as the list name. Now we can create those three landing pages and at the top of each page, we’ll add the following code that creates a cookie on the users’s machine.
<?php //Specify the list name: Email, Search or Tradeshow $marketing_segment = "Tradeshow"; //Expire in 6 months (calculated in seconds) $cookie_expiry_time = time()+15552000; //Create cookie set_cookie('marketing_segment', $marketing_segment, $cookie_expiry_time); ?>
Once this code is on the top of each page, a user that visits the page will have their system cookied for the time period you’ve specified. In this next step, we’ll be pulling the ID from Pardot for the list you created. It’s easier to define the name of a list in our code and not the actual ID of that list. FYI, this code is designed to fit with the code in this previous article where we go over Pardot integration with their REST API.
<?php //Getting the Marketing Segmentation List Id function getMarketListId($rest_domain, $pardot_user_key, $pardot_api_key, $marketing_segment){ $marketListLink = $rest_domain.'/api/list/version/3/do/query?name='.$marketing_segment.'&api_key='.$pardot_api_key.'&user_key='.$pardot_user_key; $marketListDetails = simplexml_load_file($marketListLink); $marketListId = $marketListDetails->result->list->id; return $marketListId; } ?>
The above is just a function we’ll call to determine the ID of a list. This function will be called during a check on ther system whether a cookie exists in the system of a user who visited your site through one of those campaigns. The reason why we cookie the user is because we don’t know whether they’ll fill out a form that moment. The user may return at a separate time and is ready to provide their information. So, the cookie will help us know what point of contact brought them.
In the section where we capture the user’s details from the form, add the following code to check for the cookie before the array is sent to the post function.
<?php //Checking if a list cookie exists if (isset($_COOKIE['marketing_segment'])) { $marketing_segment_id = 'list_'.getMarketListId($rest_domain, $pardot_user_key, $pardot_api_key, $_COOKIE['marketing_segment']); $pardotArray[$marketing_segment_id] = '1'; } ?>
I’ll wrap this up here. Hopefully you have a pretty good idea of the why and how to track users that come to your site.