Personalization Engine Track

NOTE: Personalization Engine Track should only be used with the V1 Personalize JavaScript as Track is built-in with our latest version. If you have any questions on what version you have implemented, please reach out to your Customer Success Manager or support@sailthru.com.

If your website does not load new pages for individual products and content (e.g. sites that are heavily AJAX-reliant), or if you have multiple URLs for the same content item (e.g. a slideshow with different URLs for each slide), Personalization Engine Track can be an extremely useful alternative to the standard implementation.

Before we walk you through the Personalization Engine JavaScript examples, here are the parameters available via Personalization Engine Track:

  • domain: Your Personalization Engine domain. Usually matches your Horizon CNAME.
  • spider: Default is true. False prevents pageviews or content creation in Sailthru. User interests are still collected.
  • noPageview: Content won’t be spidered, user interests will not be collected.
  • track_url: Default is true. False prevents the .track call or basic setup call from firing.
  • url: Manually set the url to be sent into Sailthru. Blank uses url of the page.
  • tags: Manually set the interest tags to be added to a profile. Missing param uses the tags specified on the page via the documented meta tags.
  • use_stored_tags: Don’t use the tags on the page to add to the interest profile, instead use the tags already stored in Sailthru’s Content Library for the URL being tracked.

 

Personalization Engine Track allows you to specify a URL to overwrite the URL of the actual webpage the user is on. The standard implementation of Personalization Engine track involves dropping this on your webpage:

 

Personalization Engine Track JavaScript: Redirecting a Pageview to a Different URL, Adding Additional Tags

<script type="text/javascript" src="http://ak.sail-horizon.com/horizon/v1.js"></script>
<!-- if loading for secure domain, use: https://ak.sail-horizon.com/horizon/v1.js -->
<script type="text/javascript">
 $(function() {
    if (window.Sailthru) {
        Sailthru.track({
            domain: 'horizon.sailthru.com',
            spider: true,
            track_url: true,
            url: "http://www.example.com/DEF",
            tags: ["any","additional","tags"],
        });
    }
 });
 </script>

In the above example, if the code was dropped on http://www.example.com/ABC, then it would instead attribute a pageview to www.example.com/DEF. All the previously-spidered tags from /DEF, plus any additional tags specified above, would get posted to the user’s profile.

Personalization Engine Track can also be used to turn onsite actions that can be handled by Javascript (like a button click) into Personalization Engine events that will add interest data and even record additional pageviews on a user. For example, this code turns Personalization Engine Track into a function called trackButton() that fires whenever the “Fire Track!” button is pressed:

 

Personalization Engine Track Javascript – Triggering from an Onsite Event, Posting a Pageview and Additional Tags to a User

<script type="text/javascript">
   function trackButton(){
         Sailthru.track({
            domain: 'horizon.sailthru.com',
            spider: true,
            track_url: true,
            url: "http://www.example.com/DEF",
            tags: ["tags","from","track"],
         });
      }
   });
</script>

<button type="button" onclick="trackButton()">Fire Track!</button>

When the button is clicked, the trackButton function is executed, and Sailthru.track fires a pageview for http://www.example.com/DEF with the options provided to it.

Top