Based on the interests of the current user, returns top items from an array of content or products.

list horizon_select( array input , integer quantity , optional string engine , optional object filter_tags )

Given an input array of JSON objects, returns an array of quantity of those objects that the user is determined to be most interested in by the Personalization Engine, sorted by level of interest (descending). The last two parameters, engine and filter_tags, are optional ways to further refine and filter the content that is returned, and are especially powerful when used in Site Personalization Manager sections. (See Optional Parameters, below.)

The objects in the input array can contain any number of properties, but they must contain the tags property, which must be a comma-separated string or array of strings listing the tags that are relevant to this piece of content. You also may use the weight property, which can be any number to weight the value of the piece of content. For example, if you are pulling headlines from your site you may want to give a higher weight to headlines with higher numbers of pageviews.

There are many handy uses for this function, but one of the most useful involves using a Data Feed as the source for your input array. For your data feed, you can choose to use a generated content feed.

For more information about using content feeds with this function, see Use Feeds and Other Content Data in Templates.


{myfavoritefood = horizon_select
                'name':'msd Fruit Snacks'
                'name':'Cran-Apple Fruit Snacks'
                'name':'Lemon Fruit Snacks'}

After the above function is run, your two favorite fruit snacks are available in Zephyr as {myfavoritefood[0].name} and {myfavoritefood[1].name}.

<code style="display: none;"><!--Optional Parameters <p class="c19">You can also include the <span class="c4"><code>engine and filter_tags parameters to further refine the content displayed to a user. filter_tags, which lets you require certain tags or exclude certain tags from returned content, is especially useful with Site Personalization Manager: based on the context in which the page is being viewed, you can dynamically pass in variables/tags on page load in order to affect the content that is displayed, even when that content is sourced from the same section and feed.





Specifies whether the system should treat your section as supporting media or commerce. A selection is required in advance if you are to begin using the next parameter, filter_tags, today.

media or commerce


Allows you to filter thereturned content items by specifying one or more content tags to require or exclude from the returned recommendations content. This is an object containing:

  • an array of tags
  • a flag for whether to require content with those tags (true) or exclude content with those tags (false)

{ "tags" : [kids, books, UK], "include" : true }

Your tags and include values can be dynamic values passed from your website using a vars array, per the JavaScript code specified on the Recommendations Implementation page.

You can use any variable names to send these values to the template,then include them in your filter_tags object.

For example, if you sent your tags and your include value using the variablesmytags and myinclude:
{filter_tags =
  { "tags" : mytags,
    "include" : myinclude}

{content = horizon_select( content, 6, commerce, filter_tags)}


Interest-Based Content Recommendations from a Feed

Use Case: You collect robust interest data on your users using on-site sailthru.tags, and you want to use your spidered content to recommend the top three pieces of content from a data feed. Using horizon_select, you can pick content based on user interest data. Note: personalize() has parity with horizon_select() but with additional functionality.

{personalizedContent = horizon_select(content, 3)}
Here are your top ten stories for the day!
{foreach personalizedContent as c}
<a href="{c.url}">{c.title}</a>


Here are your top three stories for the day!

Spider-Man: Threat or Menace?

Get Your First Look at the New iPhone at the Times Square Apple Store

From the Fashion Blog: The Most Comfortable Socks You’ll Ever Own

Explanation: This script uses the horizon_select() function, which finds the top three pieces of content from a data feed to users based on on-site user interest tags. Each user’s top three stories get added to an assignment called “personalizedContent”, which is then looped through in the template, displaying each title and URL in order of interest. Note: personalize() has parity with horizon_select() but with additional functionality.