join

Description

Returns a string concatenated by the delimiter provided.

Copy
 string join( mixed haystack , string delimiter )

Returns a string concatenating the list items, separated by the delimiter.

Example

{list=join(["red","blue","yellow"],"+")} ---> "red+blue+yellow"

Set User Interest on Link Click

Use Case:

You have a data feed you’re hosting, and content has an interest tags parameter, but you don’t have our Personalization Engine JavaScript on-site or the feed is third-party content. That said, you still want to be able to use Sailthru’s personalization functionality. join() allows you to create a list of those tags to be used in conjunction with the “sailthru_horizon_tags” query string parameter, allowing you to set interest on click.

Zephyr:

{foreach content as c}
{interestTags = join(c.tags,",")}
{c.url}?sailthru_horizon_tags={interestTags}
<br/>
{/foreach}

Output:

Using the second item from the eComm feed as an example, http://example.com/fiction/salemslot/ becomes http://example.com/fiction/salemslot/?sailthru_horizon_tags=genre-horror,author-stephen-king,vampires

Explanation:

This script uses a foreach loop to find the “tags” parameter on each piece of content. It then creates a string of values called “interestTags,” which is a comma-delineated version of the “tags” array from the given piece of content. This string is appended to the end of each link to the “sailthru_horizon_tags” query parameter, and upon click, Sailthru attributes user interest to those tags, as it would if visiting a page with the Personalization Engine JavaScript on sailthru.tags. This is a best practice when linking to third-party sites that you cannot place JS on.