Yum: Cookies, Bread Crumbs, and Analytics!

Yum: Cookies, Bread Crumbs, and Analytics!

If you do any online marketing, you know how difficult it is to track interested visitors through your site. You can get the info from Google Analytics, but it’s a pain.

In our case, we wanted to know the path a visitor took before sending a contact request.

See how you can keep track of this info in a cookie.

1. Set Up a Cookie

When a user first arrives in our website we save a cookie in their browser. The only information we take is the page where the user landed.

We’re using WordPress, so I went ahead and added this to the header.php file,

In the last line, we set up a cookie with the name “pathcookie” with the variable $path as its content. It expires 600 seconds after the current time (10 minutes). And, it’s only valid for our site, nearsoft.com.

2. Save the Breadcrumbs

Every time the user loads a new page we append the URL to the cookie thanks to this part of the previous code,

and,

3. Send the Breadcrumbs

If the user sends a contact request, we include the content of the cookie in the email we send. To do this, we add a hidden field to our current contact request form,

With that, you have the Post variable path available in whatever you use to send your emails in your system.

The Result should be something like this,

side-Yum-Cookies-and-Bread-Crumbs

On the other hand, if there’s no contact request the cookie expires in 10 minutes.

Either way the cookie is deleted at the end of the session.

Finally…

With this simple process we get a piece of information that helps us understand our prospects. And there’s almost no overhead to our website.

If you think this can help you, go for it. It’s really simple to implement.

Just remember: use your powers for good!

Focus Mode

Contact Request

Close

We will call you right away. All information is kept private