Passing Keywords
To implement a keyword search you need to add code to your published webpages to pass the search term values to Experience Optimization.
- ASP.NET example
-
In an ASP.NET website, call the
SetSearchTermsmethod of theQuerycontrol (referenced using the Element ID), for example:<head runat="server"> <script runat="server" language="c#"> void Page_Load(object sender, System.EventArgs e) { Query query = Page.FindControl("elementId") as Query; if (query != null) { query.SetSearchTerms("YourSearchTerm"); } } </script> </head> - Java example
-
In a Java/JSP website, add a page-scoped variable using
<elementId>__searchTerms, whereelementIdis the ID of the custom tag, for example:<% String searchTerms = "YourSearchTerm"; pageContext.setAttribute("elementId_searchTerms", searchTerms, PageContext.PAGE_SCOPE); %>