skip to Main Content

The rendering of the personalized content can work two ways:

  • Persoo does the rendering with JS by default. This is easier, works without your developer’s involvement for simple scenarios, AB tests etc. We recommend starting with this type of integration.
  • You render the content from your side. This means Persoo only provides the personalized, unique content (such as IDs of the products to be displayed). This is more complex for implementing, but has some advantages (such as real-time info on product availability). Use this integration if you or your developer want to keep control over the content.

Intro

Let’s repeat how Persoo interacts with the website. The snippet loads asynchronously the Persoo client. This client will read the parameters in the data layer, creates a request and sentd it to persoo to the RTP (Real Time Processing) unit. This unit then updates the profile and returns calculated recommendations.

schema - jak persoo funguje, integrace do webu

Data are sent through JSONP to avoid CORS problems (see more explanation on CORS).

Then one of the mentioned two ways displays the personalized data:

  • Either the HTML fragments are returned and dynamically inserted in the page through Persoo (templates have to be set-up in the Persoo administration), or
  • The personalized content is sent with the page directly from your servers. Persoo will only serve you the ID of the products (or all the product metadata if necessary).

Why use the Persoo client and not call the REST API directly?

Because Persoo Client solves for you for example:

  • Tagging the browser – it’s not only setting the cookie, since it’s value changes if multiple users access the browser
  • The Test and Production Environments – by using the Persoo Client, you can test the scenarios before publishing them live
  • AB testing – since Persoo Client injects HTML code into your website, you can easily run an AB test, whether personalized or not.
  • Additional web content – Other important added value of Persoo Client is the possibility of simply adding sideboxes, pop-ups, banners and infobars without the involvement of the developers.

How do I get the recommended product’s IDs (DEPRECATED, use rawData offers instead)?

To have all the functions described above available, it is best to keep the data layer and the Persoo Snippet, and only adjust the data reporting function. We will add a custom callback, which will get all the data necessary for the recommendations.

Go to Settings – Integrations – Your website in the Persoo Administration, and puth in the “Custom javascript” the following lines:

This JS will run before the data are sent. First line disables the default event sending and the second one ensures the custom data sending. The command “send” will include all the variables from the data layer.

  • rawData – says that we want returned also the raw data, not only the HTML fragments
  • idsOnly – expands the previous parameter, and says that we don’t want all the metadata but only the product IDs

The callback funtion “myCallbackFunction” get one parameter “data”, which contain all data reported by Persoo in the page. For example, in the case of pageview event with “pageType=homepage”, the following is returned as “data”:

Field “scenarios” contains IDs of the recommended products for all scenarios related to the given event. Other fields are custom variables, that you want to send to the page.

MyCallbackFunction for “pageType=homepage” může vypadat následovně:

Note: If you do not want to define the callback function in the Persoo administration, you can call it as follows in the page’s header:

See also Persoo JS client, method onLoad.

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

See measuring manually rendered offers and their impressions and clicks.

Back To Top
×Close search
Search