Tracking visitors



despite Varnish

Who am I

Fabrizio Balliano
PHP since 1999
In Magento since 2007 admin
Full time Magento since 2011
CTO of Sevenlike S.r.l.

What is Varnish

Web application accelerator
HTTP reverse proxy
Cache server

Tremendous speed gain
Saves CPUs
Saves network traffic
Maybe full RAM solution

What is Varnis for Magento

Full Page Cache
- Pre rendered HTML pages

Static assets
- Images

A sample infrastructure

Visitor path – page not in cache

Visitor path – page in cache

The problem is...

The web servers
never knows
about a visit
to a cached page

we track visitors other ways, yes?

Most modern tracking softwares
(actually services)
are javascript based

anyone said Google Analytics?

What about tracking visitors

Customize browsing experience
based on visitor's behavior

Reports in the backend

What about this?


And this?

But... if the frontend servers

are not getting ANY requests...

these features

(and any other tracking)

will not work

Cookies or localstorage?

Can we use them to have the "recently viewed" feature back?

Yes, it's ok, but not enogh in most cases.
It solves just part of the problem.

Let's GET BACK TO our jurney

notice anything here?

Dynamic blocks!

Types of Dynamic blocks

ESI: Edge Side Includes
  • Not visible to client
  • Before page load
  • Can be cached
  • whole site/one page
  • each user/all
  • Little data transported
  • Visible to client
  • After page load
  • Can NOT be cached
  • A lot of data

    Configuration reference

    Let's add a new dynamic block!?

    Hey, wait!

    Every call to the frontend servers matters!

    Can we reach our goal

    without adding a new

    ESI/AJAX dynamic block?

    Flash messages!




    Flash messages:  let's extend them

    Flash messages:  let's extend them

    class Fballiano_TurpentineRecentlyViewed_Block_Messages extends Nexcessnet_Turpentine_Block_Core_Messages
        public function _prepareLayout()
            // code to do whatever we want
            return parent::_prepareLayout();


    Tracking visitors despite Varnish

    By Fabrizio Balliano

    Tracking visitors despite Varnish

    If you've Varnish as your Full Page Cache provider you'll have great performance with some limitations. One of them is that your Magento backend servers will not know about your visitors' browsing paths (mostly). This presentation was created for the Meet Magento 2014 Poland.

    • 1,285

    More from Fabrizio Balliano