Adding Experience Optimization search (deprecated) to Page Templates

The Search Experience Optimization Template Building Block (deprecated) inserts code in your webpages to implement search functionality, which can display results based on search terms or synonyms of search terms.

Before you begin

To create templates you must have Template Management rights and Write permissions for the Folder in which you intend to create the template.

About this task

Search functionality within Experience Optimization allows you to display targeted content based on a user's search term (or terms). When a search query is executed, Elasticsearch (replacement for Fredhopper) returns Promotions and content items that match the query.

Search functionality within Experience Optimization is deprecated as of the SDL Tridion Sites 9 release.

Procedure

  1. Open Template Builder.
  2. Open or Create a Compound Page Template.
  3. Make sure your Dreamweaver template has <tcdl:region> tags, for example:
    <tcdl:region id="Sidebar" type="SmartTarget"> 
    </tcdl:region>
  4. Add the following Template Building Blocks in the given order Template Building Block after the Dreamweaver Template (or equivalent output) in your Page Template.
    1. Add Experience Optimization Query
    2. Search Experience Optimization
    3. Show Experience Optimization Items
    4. Apply Experience Optimization Settings
  5. Select the Search Experience Optimization Template Building Block and define the attributes:
    AttributeDescription
    Search Type*Specify a type of search:
    • parameter—retrieves the search terms entered by the user from the URL query string.

      Specify the name of the query string parameter in which you pass search terms in the Query string parameter attribute.

    • referrer—uses the search terms entered in a search engine to search for content items.
    • keyword—uses the search terms specified in the webpage.

      To implement a keyword search you need to add code to your published webpages to pass the search term values to Experience Optimization.

    Query string parameter

    When the value of Search Type is parameter, enter the name of the URL parameter from which Experience Optimization retrieves the search terms. For example, enter q if the URL is google.com/q=example.

  6. (Optional) To handle content items related to the search query, use the Show Experience Optimization Items Template Building Block. Define the following attributes, as needed.
    AttributeDescription
    Page Region*Specify the region of your webpage where content items relating to search are displayed. The value must correspond with an id value specified in the <tcdl:region> tag of a Dreamweaver template exactly (Page Region values are case-sensitive).
    Maximum items to display*Specify the maximum number of content items that are allowed to be displayed in the Page Region.
    Header markupDefine a header section for content items returned by a query.
  7. Run and debug the template: