A client-side replacement for the Magento visitor log
Magento’s visitor log has a few issues.
When I set out to begin working on a view-through abandonment email trigger, I realized that I’d have to build out my own visitor logging in order to solve a few of these issues, and I wanted to make that available to the community for free.
The visitor log isn’t terribly compatible with full page caching (let alone Varnish), and doesn’t have an easy way to associate page views with the email address of a guest who isn’t logged in (but who perhaps has already been cookied from a newsletter or other previous interaction).
This is what Better Visitor Log intends to solve.
How are visitor logs saved?
There are two modes that you can enable for saving the logs:
This will log visits to your database. Keep in mind that this is going to log a metric butt-ton of data , particularly for high-traffic sites.
There isn’t currently any interface to these logs. But you could, for example, put together a query using the Custom Reports module to show view-through abandonment.
Another option that you can use (either in tandom or as a replacement for database logging) is Mixpanel logging. This will send your customer page view events directly to your Mixpanel account.
You can just grab your Mixpanel token and drop it in the Magento settings under System > Config > System:
Then you’ll see page views show up in your Mixpanel dashboard:
How are emails captured?
Better Visitor Log captures email address for visitors in a number of ways. It can recognize query string parameters such as
mceid(the query string param that Mailchimp uses to tag newsletter subscribers when they click through from a newsletter).
Also, as email addresses are typed into fields on the website such as a newsletter signup field, or a checkout field, it will notice those and save the email to a cookie.
And of course, if a customer is logged in, it will recognize their email address from their customer record and use that for tracking.
What are some use cases for this?
There are a number of interesting use cases for this logging functionality.
Detect customers or visitors that have browsed products but not purchased. You could use the Custom Reports module for example with a query such as the following:
|l.email as ‘Email‘|
|, MAX(l.created_at) as ‘Last Viewed‘|
|, group_concat(product_name.value) as ‘Products‘|
|, IFNULL(customer_firstname.value, ‘Guest‘) as ‘Customer Name‘|
|FROM kj_bettervisitorlog_log AS l|
|LEFT JOIN sales_flat_order AS o ON o.customer_email = l.email AND o.created_at > l.created_at|
|LEFT JOIN customer_entity AS customer ON customer.email = l.email|
|LEFT JOIN customer_entity_varchar AS customer_firstname ON customer_firstname.attribute_id = 5|
|AND customer_firstname.entity_id = customer.entity_id|
|LEFT JOIN catalog_product_entity AS product ON product.entity_id = l.product_id|
|LEFT JOIN catalog_product_entity_varchar AS product_name ON product_name.entity_id = product.entity_id|
|AND product_name.attribute_id = 71|
|WHERE l.product_id is not null|
|GROUP BY l.email|
Which would give you the following report:
Recommended Product Blocks
You could tie visitor product views into Related Product data in order to provide recommendations to them. I believe Magento Enterprise already does this, but I’m not exactly sure how well it would play with Varnish for example without some custom hole punching.
How do I install this?
I thought you’d never ask! Here’s a demo of the installation and setup process, walking you through how to use and test some of the features:
Sound Interesting? Take it for a spin!
Sign up with your email here to receive the module. You’ll receive the occassional marketing-related email from MageMail (hey we gotta pay the bills over here!) but can unsubscribe at any time and your email will never be shared or sold.