skip to Main Content

How to tag the rendered content, in order to make measuring of impressions and clicks work

Persoo automatically adds listeners to it’s content boxes. They report real impressions (i.e. the box was actually visible on the screen) and clicks. If you want to keep this functionality, each personalized box needs to be tagged as follows:


  • class: persooLocation – this class identifies that this is Persoo related box and should be measured
  • data-location-id – ID of the location, in which can be displayed more than one offer. It’s ID is also visible in the URL when you edit the location or scenario in the Persoo Administration.
  • data-offer-id – ID of the offer displayed in the location. Again can be found in the Administration in the URL
  • data-component-type – will always be “default” when rendering from your side. Otherwise describes the type of a widget served by Persoo.

Note: A location container with a specific ID can be only 1 per page.

If the location is rendered after the page is loaded (e.g. through AJAX), you need to call:

in order to get Persoo to refresh location tracking. This function generally takes about 0,2ms, so you don’t have to worry about calling.

The locations inserted by Persoo are tracked automatically.

Measuring custom locations

If you have your custom location IDs, you need to always call updateLocationTracking().

If you want this to be automatic, you can run this tracking regularly as follows (not recommended):

Options for serverLocationTracking are

  • once – tries to find the custom locations only on page load
  • interval – runs the function updateLocationTracking(), regularly. The interval is set in milliseconds in the command serverLocationTrackingInterval. If the defined interval is too short, the minimum allowed interval is used.
  • none – default, does not have to be specified

Inner Locations

Sometimes, you need to insert HTML content into page, but not to measure impressions of the inserted container, but impressions of it’s inner part. I.e. when you want add a “tab” into carousel, you don’t want to measure impressions of the tab “ear”, but impressions of the tab content. In such case, you define, that the tab content is an inner location for the click and impression tracking. Automatically added listeners for real impressions and click will be added to inner location element only and not to the location element.

In case, you need event more. I.e. you need to insert HTML content into page, not to display it directly, but use it as an source HTML input for another javascript, which will move it to correct location. One example is, that you prepare the content for “prebasket”, but the content itself will be displayed with another javascript, i.e. with the confirmation that the product was successfully added to basket. In this case, you need to refresh impression and click tracking manually, by calling

That will update tracking for all locations, that were moved. In case there are multiple locations or inner locations with the same locationId data attribute, it will measure all of them.

Back To Top
×Close search