<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Analytics APIs Archives - SearchStax Docs</title>
	<atom:link href="https://demo.searchstax.com/docs/searchstudio_categories/api-analytics/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Documentation</description>
	<lastBuildDate>Sun, 30 Mar 2025 17:35:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>

<image>
	<url>https://demo.searchstax.com/docs/wp-content/uploads/2023/10/cropped-favicon-32x32.png</url>
	<title>Analytics APIs Archives - SearchStax Docs</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Tracking API (REST)</title>
		<link>https://demo.searchstax.com/docs/searchstudio/searchstax-studio-analytics-rest-api/</link>
		
		<dc:creator><![CDATA[Bruce]]></dc:creator>
		<pubDate>Thu, 08 Jul 2021 22:25:44 +0000</pubDate>
				<guid isPermaLink="false">https://demo.searchstax.com/docs/?post_type=site_search&#038;p=9272</guid>

					<description><![CDATA[<p>Tracking API (REST) This page describes how to add&#160;SearchStax&#160;Site Search solution&#8217;s Analytics Events&#160;to your search page. The Tracking API (Javascript) page describes how you can use a helper Javascript library&#8230; <a class="more-link" href="https://demo.searchstax.com/docs/searchstudio/searchstax-studio-analytics-rest-api/">Continue reading <span class="screen-reader-text">Tracking API (REST)</span></a></p>
<p>The post <a href="https://demo.searchstax.com/docs/searchstudio/searchstax-studio-analytics-rest-api/">Tracking API (REST)</a> appeared first on <a href="https://demo.searchstax.com/docs">SearchStax Docs</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h1 class="wp-block-heading" id="h-tracking-api-rest">Tracking API (REST)</h1>



<hr class="wp-block-separator has-css-opacity"/>



<p>This page describes how to add&nbsp;SearchStax&nbsp;Site Search solution&#8217;s <strong>Analytics Events</strong>&nbsp;to your search page. The <a href="/docs/searchstudio/searchstax-studio-javascript-tracking-api/">Tracking API (Javascript)</a> page describes how you can use a helper Javascript library to push Analytics events. This document describes how the same events can be pushed using just a REST API.</p>



<p></p>



<pre class="wp-block-preformatted">  </pre>



<p></p>



<h2 class="wp-block-heading">Analytics URL, Key and the REST Endpoint</h2>



<p>On the Settings page of your Search App, the <strong>Analytics API</strong> tab contains the base URL for the API and the Analytics Key. The analytics key identifies the Search App.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="944" height="339" src="https://demo.searchstax.com/docs/wp-content/uploads/2023/09/image-11.png" alt="" class="wp-image-16215" srcset="https://demo.searchstax.com/docs/wp-content/uploads/2023/09/image-11.png 944w, https://demo.searchstax.com/docs/wp-content/uploads/2023/09/image-11-300x108.png 300w, https://demo.searchstax.com/docs/wp-content/uploads/2023/09/image-11-768x276.png 768w" sizes="(max-width: 944px) 100vw, 944px" /></figure>



<p>The Analytics REST endpoint is <strong><code>&lt;Analytics URL&gt;/api/v2/track/</code>.</strong></p>



<p>Example: <code>https://analytics-us.searchstax.com/api/v2/track/</code></p>



<p>Different events can be pushed to this endpoint as described in the sections below.</p>



<h2 class="wp-block-heading">Events</h2>



<p>An “event” is a user action on your search page, such as searching for a keyword or clicking on a search result. SearchStax supports the following event messages:</p>



<ul class="wp-block-list">
<li><a href="#track-searches-and-impressions">_search</a> </li>



<li><a href="#track-related-searches-and-impressions">_relatedsearch</a>  </li>



<li><a href="#track-search-clicks">_searchclick</a>  </li>



<li><a href="#track-related-search-clicks">_relatedsearchclick</a> </li>



<li><a href="#track-search-satisfaction">_searchSatisfaction</a> </li>
</ul>



<p>Each type of event has its own set of required properties, which are detailed below. The following are the common properties across all events:</p>


<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string  </td>
<td>This is the unique analytics app key as shown in the “Analytics API” tab of your App within Search App Management</td>
<td>&#8216;IeDTTDD1ubJdfPMmu7MMxxVjUMdw6vo52BjPixxqwcQ&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string  </td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session. If omitted, some analytics features cannot be fully reported.</td>
<td>‘qqMKt4fxhcud0T5c3UJ5spgug’</td>
</tr>
<tr>
<td><strong>_vid:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string </td>
<td>Unique Identifier to identify a visitor</td>
<td>&#8216;d7cc372a-2be6-ee1e-26e8-0f903fa36e67&#8217;</td>
</tr>
</tbody>
</table>
</figure>


<p><strong>session</strong> can be obtained using the following helper function:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
getSession : function(name){
	var name = &#039;searchcookie&#039;;
	var session = document.cookie.match(new RegExp(&#039;(^| )&#039; + name + &#039;=(&#x5B;^;]+)&#039;));
	return session&#x5B;2];
}

</pre></div>


<h2 class="wp-block-heading" id="search-events-vs-related-search-events">Search Events vs Related Search Events</h2>



<p>The &#8220;search&#8221; and &#8220;related-search&#8221; events are intended to be used in the following fashion:</p>



<ol class="wp-block-list">
<li>Your search page sends a query to the search API. The search results are returned. A <a href="#track-searches-and-impressions">track</a> event fires to track the impressions from the search results.</li>



<li>If using the related searches features, your search page sends a request to the related searches API to get related searches for the query. The related searches are returned. A <a href="#track-related-searches-and-impressions">trackRelatedSearch</a> event fires to track the related searches that were returned</li>



<li>If the user clicks on a document, a <a href="#track-clicks">trackClick</a> event fires to track which document was clicked on.</li>



<li>If the user clicks on a related search, a <a href="#track-related-search-clicks">trackRelatedSearchClick</a> event fires to track which related search was clicked on. </li>
</ol>



<pre class="wp-block-preformatted">   
</pre>



<h2 class="wp-block-heading" id="track-searches-and-impressions">Track Searches and Impressions</h2>



<p>To track searches, create a data object as below, which specifies the event type as <code>_search</code>.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
var searchObj = {
  &quot;event&quot;: &quot;_search&quot;,
  &quot;properties&quot;: {
    &quot;key&quot;: &quot;imDMrs56aTaDJc6jihDejUkDZYj3Gm8riJHlR0V1S58&quot;,
    &quot;query&quot;: &quot;sitecore&quot;,
    &quot;shownHits&quot;: 3,
    &quot;totalHits&quot;: 12,
    &quot;pageNo&quot;: 1,
    &quot;latency&quot;: 6,
    &quot;session&quot;: &quot;r6ivpxkd3e294kJ299V0tVb1q&quot;,
    &quot;impressions&quot;: &#x5B;
      {
        &quot;cDocId&quot;: &quot;https://www.searchstax.com/solutions/sitecore-solr/&quot;,
        &quot;cDocTitle&quot;: &quot;Managed Solr Service for Sitecore | SearchStax&quot;,
        &quot;position&quot;: 1
      },
      {
        &quot;cDocId&quot;: &quot;https://www.searchstax.com/blog/site-search-for-sitecore-video/&quot;,
        &quot;cDocTitle&quot;: &quot;SearchStudio for Sitecore - Video | The Search Experience Blog&quot;,
        &quot;position&quot;: 2
      },
      {
        &quot;cDocId&quot;: &quot;https://www.searchstax.com/solutions/sitecore-azure-to-solr-migration/&quot;,
        &quot;cDocTitle&quot;: &quot;Migrate Azure Search to Solr for Sitecore | SearchStax&quot;,
        &quot;position&quot;: 3
      }
    ],
    &quot;_vid&quot;: &quot;d7cc372a-2be6-ee1e-26e8-0f903fa36e67&quot;,
    &quot;language&quot;: &quot;en&quot;
  }
}

</pre></div>


<p></p>


<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>event:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Type of user action on the search page.</td>
<td>&#8216;_search&#8217;</td>
</tr>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Unique Analytics API Key</td>
<td>&#8216;IeDTTDD1ubJdfPMmu7MMxxVjUMdw6vo52BjPixxqwcQ&#8217;</td>
</tr>
<tr>
<td><strong>user:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>A token identifying the webpage user. This datum is stored but is not currently used.</td>
<td>&#8216;smith123&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session.</td>
<td>&#8216;qqMKt4fxhcud0T5c3UJ5spgug&#8217;</td>
</tr>
<tr>
<td><strong>query:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The query string from your search page, or <strong>q</strong> from the response document.</td>
<td>&#8216;sitecore plugin&#8217;</td>
</tr>
<tr>
<td><strong>shownHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits shown in the response document.</td>
<td>10</td>
</tr>
<tr>
<td><strong>totalHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits in the index, from the response document.</p>
<p><strong>Note:</strong> To track searches that returned no results, set totalHits to 0.</p>
</td>
<td>1890</td>
</tr>
<tr>
<td><strong>latency:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of milliseconds to execute a search. You define the semantics. (One possibility is to use Qtime from the response document). Without this value, Analytics will not calculate average latency.</td>
<td>150</td>
</tr>
<tr>
<td><strong>pageNo:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The page number of the displayed results, from the response document.</td>
<td>1</td>
</tr>
<tr>
<td><strong>impressions:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />array</td>
<td>An array of dictionaries, each describing a search result &#8220;impression.&#8221;<br />It lets the Analytics App track the documents that were displayed to the user as search results, whether the user clicked on them or not</td>
<td><code>[<br />{'cDocId': 'aDocId1', 'cDocTitle': 'aDocTitle1', 'position': 1},<br />{'cDocId': 'aDocId2', 'cDocTitle': 'aDocTitle2', 'position': 2}, ..<br />]</code><br />where <code>cDocId</code> is the unique ID of the document and <code>cDocTitle</code> is the title that is displayed for the search result.<br />The position numbers should start with 1</td>
</tr>
<tr>
<td><strong>_vid</strong>:<br /><span class="has-inline-color" style="color: #32cd32;"><span class="has-inline-color" style="color: #ff0000;">required</span></span><br />string</td>
<td>Unique Identifier for the visitor.</td>
<td>d7cc372a-2be6-ee1e-26e8-0f903fa36e67</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="https://demo.searchstax.com/docs/searchstudio/multi-language-experiences/#default">default language</a>.</td>
<td>&#8220;en&#8221;, &#8220;fr&#8221;, or &#8220;es&#8221;</td>
</tr>
</tbody>
</table>
</figure>


<p></p>



<h3 class="wp-block-heading">Calling the Analytics REST endpoint (/track API)</h3>



<p>To call the REST API and insert the event, the event objects should be encoded to Base64 and passed as the <code>data</code>. For example, for the above request, you can use online base64 encoders such as <a href="https://www.base64encode.org/">https://www.base64encode.org/</a> to encode the object and then call the API endpoint as follows:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; quick-code: false; notranslate">
curl -vL &quot;https://analytics-us.searchstax.com/api/v2/track/?data=ewogICJldmVudCI6ICJfc2VhcmNoIiwKICAicHJvcGVydGllcyI6IHsKICAgICJrZXkiOiAiaW1ETXJzNTZhVGFESmM2amloRGVqVWtEWllqM0dtOHJpSkhsUjBWMVM1OCIsCiAgICAicXVlcnkiOiAic2l0ZWNvcmUiLAogICAgInNob3duSGl0cyI6IDMsCiAgICAidG90YWxIaXRzIjogMTIsCiAgICAicGFnZU5vIjogMSwKICAgICJsYXRlbmN5IjogNiwKICAgICJzZXNzaW9uIjogInI2aXZweGtkM2UyOTRrSjI5OVYwdFZiMXEiLAogICAgImltcHJlc3Npb25zIjogWwogICAgICB7CiAgICAgICAgImNEb2NJZCI6ICJodHRwczovL3d3dy5zZWFyY2hzdGF4LmNvbS9zb2x1dGlvbnMvc2l0ZWNvcmUtc29sci8iLAogICAgICAgICJjRG9jVGl0bGUiOiAiTWFuYWdlZCBTb2xyIFNlcnZpY2UgZm9yIFNpdGVjb3JlIHwgU2VhcmNoU3RheCIsCiAgICAgICAgInBvc2l0aW9uIjogMQogICAgICB9LAogICAgICB7CiAgICAgICAgImNEb2NJZCI6ICJodHRwczovL3d3dy5zZWFyY2hzdGF4LmNvbS9ibG9nL3NpdGUtc2VhcmNoLWZvci1zaXRlY29yZS12aWRlby8iLAogICAgICAgICJjRG9jVGl0bGUiOiAiU2l0ZSBTZWFyY2ggZm9yIFNpdGVjb3JlIC0gVmlkZW8gfCBUaGUgU2VhcmNoIEV4cGVyaWVuY2UgQmxvZyIsCiAgICAgICAgInBvc2l0aW9uIjogMgogICAgICB9LAogICAgICB7CiAgICAgICAgImNEb2NJZCI6ICJodHRwczovL3d3dy5zZWFyY2hzdGF4LmNvbS9zaXRlY29yZS1henVyZS10by1zb2xyLW1pZ3JhdGlvbi8iLAogICAgICAgICJjRG9jVGl0bGUiOiAiTWlncmF0ZSBBenVyZSBTZWFyY2ggdG8gU29sciBmb3IgU2l0ZWNvcmUgfCBTZWFyY2hTdGF4IiwKICAgICAgICAicG9zaXRpb24iOiAzCiAgICAgIH0KICAgIF0sCiAgICAiX3ZpZCI6ICJkN2NjMzcyYS0yYmU2LWVlMWUtMjZlOC0wZjkwM2ZhMzZlNjciCiAgfQp9&quot;

</pre></div>


<p>The above method returns an HTTP status code of 201/204 if the event was successfully added.</p>



<p>If the data is large, you should use POST instead of GET API.</p>



<p>If the data contains special characters, you should make sure it is URL encoded (Can test on <a href="https://www.urlencoder.org/">https://www.urlencoder.org/</a>)</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; auto-links: false; title: ; quick-code: false; notranslate">
DATA = urlEncode(base64encode(searchObj))
curl -v &quot;https://analytics-us.searchstax.com/api/v2/track/?data=$DATA&quot;
</pre></div>


<p></p>



<h2 class="wp-block-heading" id="track-related-searches-and-impressions">Track Related Searches and Impressions</h2>



<p>To track related searches, create a data object as below, which specifies the event type as&nbsp;<code>_relatedsearch</code>.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; auto-links: false; title: ; quick-code: false; notranslate">
var relatedSearchObj = {
  &quot;event&quot;:&quot;_relatedsearch&quot;,
  &quot;properties&quot;:{
    &quot;session&quot;:&quot;JKaqFFK088vyrTkIBwBeWDyhQ&quot;,
    &quot;key&quot;:&quot;IeDTTDD1ubJdfPMmu7MMxxVjUMdw6vo52BjPixxqwcQ&quot;,
    &quot;query&quot;:&quot;solr&quot;,
    &quot;shownHits&quot;:2,
    &quot;pageNo&quot;: 1,
    &quot;impressions&quot;:&#x5B;
      {&quot;relatedSearch&quot;:&quot;managed solr&quot;,
      &quot;position&quot;:1},
      {&quot;relatedSearch&quot;:&quot;solr 7&quot;,
      &quot;position&quot;:2}
    ],
    &quot;_vid&quot;:&quot;d7cc372a-2be6-ee1e-26e8-0f903fa36e67&quot;,
    &quot;language&quot;: &quot;en&quot;
}}

</pre></div>

<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>event:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>Type of user action on the search page.</td>
<td>‘_relatedsearch’</td>
</tr>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Unique Analytics API Key</td>
<td>&#8216;4Qp1Sv9MnALbAGbixW9ZaWrHxpbfwm6i&#8217;</td>
</tr>
<tr>
<td><strong>user:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>A token identifying the webpage user. This datum is stored but is not currently used.</td>
<td>&#8216;smith123&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session.</td>
<td>&#8216;XDJFNS355FGDFVVDFG&#8217;</td>
</tr>
<tr>
<td><strong>query:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The query string from your search page, or <strong>q</strong> from the response document.</td>
<td>&#8216;sitecore plugin&#8217;</td>
</tr>
<tr>
<td><strong>shownHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits shown in the response document.</td>
<td>10</td>
</tr>
<tr>
<td><strong>latency:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of milliseconds to execute a search. You define the semantics. (One possibility is to use Qtime from the response document). Without this value, Analytics will not calculate average latency.</td>
<td>150</td>
</tr>
<tr>
<td><strong>impressions:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />array</td>
<td>An array of dictionaries, each describing a related search “impression.”<br />It lets the Analytics App track the related searches that were displayed to the user as search results, whether the user clicked on them or not</td>
<td><code><code>[</code><br /><code>{'relatedSearch': 'an example related search', 'position': 1},</code><br /><code>{'relatedSearch': 'another example related search', 'position': 2}, ..</code><br /><code>]</code><br />where <code>relatedSearch</code> is the related search query. The position numbers should start with 1</code></td>
</tr>
<tr>
<td><strong>_vid</strong>:<br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;"><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark></mark><br />string</td>
<td>Unique Identifier for the visitor.</td>
<td>d7cc372a-2be6-ee1e-26e8-0f903fa36e67</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="https://demo.searchstax.com/docs/searchstudio/multi-language-experiences/#default">default language</a>.</td>
<td>&#8220;en&#8221;, &#8220;fr&#8221;, or &#8220;es&#8221;</td>
</tr>
</tbody>
</table>
</figure>


<h3 class="wp-block-heading">Calling the Analytics REST endpoint (/track API)</h3>



<p>To call the REST API and insert the event, the event objects should be encoded to Base64 and passed as the <code>data</code>. For example, for the above request, you can use online base64 encoders such as <a href="https://www.base64encode.org/">https://www.base64encode.org/</a> to encode the object and then call the API endpoint as follows:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; quick-code: false; notranslate">
curl -vL &quot;https://analytics-us.searchstax.com/api/v2/track/?data=ewogICJldmVudCI6Il9yZWxhdGVkc2VhcmNoIiwKICAicHJvcGVydGllcyI6ewogICAgInNlc3Npb24iOiJKS2FxRkZLMDg4dnlyVGtJQndCZVdEeWhRIiwKICAgICJrZXkiOiJJZURUVEREMXViSmRmUE1tdTdNTXh4VmpVTWR3NnZvNTJCalBpeHhxd2NRIiwKICAgICJxdWVyeSI6InNvbHIiLAogICAgInNob3duSGl0cyI6MiwKICAgICJwYWdlTm8iOiAxLAogICAgImltcHJlc3Npb25zIjpbCiAgICAgIHsicmVsYXRlZFNlYXJjaCI6Im1hbmFnZWQgc29sciIsCiAgICAgICJwb3NpdGlvbiI6MX0sCiAgICAgIHsicmVsYXRlZFNlYXJjaCI6InNvbHIgNyIsCiAgICAgICJwb3NpdGlvbiI6Mn0KICAgIF0sCiAgICAiX3ZpZCI6ImQ3Y2MzNzJhLTJiZTYtZWUxZS0yNmU4LTBmOTAzZmEzNmU2NyIsCn19&quot;
</pre></div>


<p>The above method returns an HTTP status code of 201/204 if the event was successfully added.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; auto-links: false; title: ; quick-code: false; notranslate">
DATA = urlEncode(base64encode(searchObj))
curl -v &quot;https://analytics-us.searchstax.com/api/v2/track/?data=$DATA&quot;
</pre></div>


<h2 class="wp-block-heading" id="track-search-clicks">Track Search Clicks</h2>



<p>To start generating data around click-through events, search quality and relevance, have <strong><code>/track</code></strong> send <code>_searchclick</code> event to the Analytics App.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; quick-code: false; notranslate">
var searchClickObj = {
  &quot;event&quot;: &quot;_searchclick&quot;,
  &quot;properties&quot;: {
    &quot;key&quot;: &quot;imDMrs56aTaDJc6jihDejUkDZYj3Gm8riJHlR0V1S58&quot;,
    &quot;query&quot;: &quot;sitecore&quot;,
    &quot;shownHits&quot;: 12,
    &quot;totalHits&quot;: 143,
    &quot;pageNo&quot;: 1,
    &quot;latency&quot;: 6,
    &quot;session&quot;: &quot;jtVM0lqSBMEfmBDYBHaUjodIL&quot;,
    &quot;cDocId&quot;: &quot;https://www.searchstax.com/blog/site-search-for-sitecore-video/&quot;,
    &quot;cDocTitle&quot;: &quot;SearchStudio for Sitecore - Video | The Search Experience Blog&quot;,
    &quot;position&quot;: 2,
    &quot;_vid&quot;: &quot;d7cc372a-2be6-ee1e-26e8-0f903fa36e67&quot;,
    &quot;language&quot;: &quot;en&quot;
  }
}

</pre></div>


<p></p>


<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>event:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Type of user action on search page.</td>
<td>&#8216;_searchclick&#8217;</td>
</tr>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Unique Analytics API Key</td>
<td>&#8216;IeDTTDD1ubJdfPMmu7MMxxVjUMdw6vo52BjPixxqwcQ&#8217;</td>
</tr>
<tr>
<td><strong>user:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>A token identifying the webpage user. This datum is stored but is not currently used.</td>
<td>&#8216;smith123&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session.</td>
<td>&#8216;qqMKt4fxhcud0T5c3UJ5spgug&#8217;</td>
</tr>
<tr>
<td><strong>query:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The query string from your search page, or <strong>q</strong> from the response document.</td>
<td>&#8216;sitecore&#8217;</td>
</tr>
<tr>
<td><strong>cDocId:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The document ID from the response document.</td>
<td>&#8216;https://www.searchstax.com/blog/site-search-for-sitecore-video/&#8217;</td>
</tr>
<tr>
<td><strong>cDocTitle</strong><br /><span class="has-inline-color" style="color: #32cd32;"><span class="has-inline-color" style="color: #ff0000;">required</span></span><br />string</td>
<td>The document title from the response document. Note: In some applications, the document title may change. Analytics can be calculated as long as cDocID remains constant.</td>
<td>&#8216;SearchStax Studio for Sitecore &#8211; Video | The Search Experience Blog&#8217;</td>
</tr>
<tr>
<td><strong>position:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />number</td>
<td>Absolute position of the document in the full list of results. If we&#8217;re showing ten items per page, the first result on the 5th page is position in position 41. First item on the first page has position as 1</td>
<td>2</td>
</tr>
<tr>
<td><strong>pageNo:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The page number of the displayed results, from the response document.</td>
<td>1</td>
</tr>
<tr>
<td><strong>pageUrl:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>The URL of the page that is sending the tracking request</td>
<td>&#8216;https://searchstudio.searchstax.com/search&#8217;</td>
</tr>
<tr>
<td><strong>shownHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits shown in the response document.</td>
<td>10</td>
</tr>
<tr>
<td><strong>totalHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits in the index, from the response document.</td>
<td>1890</td>
</tr>
<tr>
<td><strong>_vid</strong>:<br /><span class="has-inline-color" style="color: #32cd32;"><span class="has-inline-color" style="color: #ff0000;">required</span></span><br />string</td>
<td>Unique Identifier for the visitor.</td>
<td>d7cc372a-2be6-ee1e-26e8-0f903fa36e67</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="https://demo.searchstax.com/docs/searchstudio/multi-language-experiences/#default">default language</a>.</td>
<td>&#8220;en&#8221;, &#8220;fr&#8221;, or &#8220;es&#8221;</td>
</tr>
</tbody>
</table>
</figure>


<p>To call the REST API and insert the event, the event object should be encoded to Base64 and passed as the <code>data</code>, just like for the _search event</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; quick-code: false; notranslate">
DATA = urlEncode(base64encode(searchClickObj))
curl -v &quot;https://analytics-us.searchstax.com/api/v2/track/?data=$DATA&quot;
</pre></div>


<p>The above method returns an HTTP status code of 201/204 if the event was successfully added. </p>



<h2 class="wp-block-heading" id="track-related-search-clicks">Track Related Search Clicks</h2>



<p>To start generating data around click-through events, search quality and relevance, have&nbsp;<code>/track</code>&nbsp;send&nbsp;<code>_relatedsearchclick</code>&nbsp;event to the Analytics App.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; quick-code: false; notranslate">
{&quot;event&quot;:&quot;_relatedsearchclick&quot;,&quot;properties&quot;:{&quot;session&quot;:&quot;JKaqFFK088vyrTkIBwBeWDyhQ&quot;,&quot;key&quot;:&quot;tACKiVHqhd22wS3AEE3EYmKwbriokhs04Yja6uoAaXk&quot;,&quot;query&quot;:&quot;solr&quot;,&quot;relatedSearch&quot;:&quot;managed solr&quot;,&quot;pageNo&quot;:1,&quot;shownHits&quot;:1,&quot;totalHits&quot;:1,&quot;_vid&quot;:&quot;0b7fef5a-2deb-2e4e-15d3-5c8e4a19d58c&quot;,&quot;tt&quot;:1645231821464,&quot;pageUrl&quot;:&quot;https%3A%2F%2Fsearchstudio.searchstax.co%2Fapps%2Fyivdt5dND9n3WqjZOD5ZKIgbvzdz5lBH7gsVPRg6sAY%2Fsearch.html%3FsearchStudioQuery%3Dsolr%26style%3Dfalse%26facets%3D%26sort%3D%26start%3D0&quot;}}
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; auto-links: false; title: ; quick-code: false; notranslate">
var searchClickObj = {
  &quot;event&quot;: &quot;_relatedsearchclick&quot;,
  &quot;properties&quot;: {
    &quot;key&quot;: &quot;imDMrs56aTaDJc6jihDejUkDZYj3Gm8riJHlR0V1S58&quot;,
    &quot;query&quot;: &quot;sitecore&quot;,
    &quot;shownHits&quot;: 12,
    &quot;totalHits&quot;: 143,
    &quot;pageNo&quot;: 1,
    &quot;latency&quot;: 6,
    &quot;session&quot;: &quot;jtVM0lqSBMEfmBDYBHaUjodIL&quot;,
    &quot;relatedSearch&quot;: &quot;Sitecore 7&quot;,
    &quot;position&quot;: 2,
    &quot;_vid&quot;: &quot;d7cc372a-2be6-ee1e-26e8-0f903fa36e67&quot;,
    &quot;language&quot;: &quot;en&quot;
  }
}

</pre></div>

<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>event:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>Type of user action on search page.</td>
<td>‘_relatedsearchclick’</td>
</tr>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Unique Analytics API Key</td>
<td>&#8216;4Qp1Sv9MnALbAGbixW9ZaWrHxpbfwm6i&#8217;</td>
</tr>
<tr>
<td><strong>user:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>A token identifying the webpage user. This datum is stored but is not currently used.</td>
<td>&#8216;smith123&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session.</td>
<td>&#8216;XDJFNS355FGDFVVDFG&#8217;</td>
</tr>
<tr>
<td><strong>query:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The query string from your search page, or <strong>q</strong> from the response document.</td>
<td>&#8216;sitecore plugin&#8217;</td>
</tr>
<tr>
<td><strong>position:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />number</td>
<td>Absolute position of the related search in the full list of results. If we’re showing ten related searches per page, the first related search on the 5th page is position in position 41. First related search on the first page has position as 1</td>
<td>41</td>
</tr>
<tr>
<td><strong>relatedSearch:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>The related search term that was clicked on.</td>
<td>&#8216;sitecore 7&#8217;</td>
</tr>
<tr>
<td><strong>pageNo:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The page number of the displayed results, from the response document.</td>
<td>1</td>
</tr>
<tr>
<td><strong>pageUrl:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>The URL of the page that is sending the tracking request</td>
<td>&#8216;https://searchstudio.searchstax.com/search&#8217;</td>
</tr>
<tr>
<td><strong>shownHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits shown in the response document.</td>
<td>10</td>
</tr>
<tr>
<td><strong>totalHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits in the index, from the response document.</td>
<td>1890</td>
</tr>
<tr>
<td><strong>_vid</strong>:<br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;"><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark></mark><br />string</td>
<td>Unique Identifier for the visitor.</td>
<td>d7cc372a-2be6-ee1e-26e8-0f903fa36e67</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="https://demo.searchstax.com/docs/searchstudio/multi-language-experiences/#default">default language</a>.</td>
<td>&#8220;en&#8221;, &#8220;fr&#8221;, or &#8220;es&#8221;</td>
</tr>
</tbody>
</table>
</figure>


<p>To call the REST API and insert the event, the event object should be encoded to Base64 and passed as the&nbsp;<code>data</code>, just like for the <code>_relatedsearch</code> event</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; auto-links: false; title: ; quick-code: false; notranslate">
DATA = urlEncode(base64encode(searchClickObj))
curl -v &quot;https://analytics-us.searchstax.com/api/v2/track/?data=$DATA&quot;
</pre></div>


<p>The above method returns an HTTP status code of 201/204 if the event was successfully added.</p>



<p>&nbsp;&nbsp;</p>



<p></p>



<h2 class="wp-block-heading" id="track-search-satisfaction">Track Search Satisfaction</h2>



<p>SearchStax provides the ability to collect qualitative feedback about the search experience using the event <code>_searchSatisfaction</code> as shown below:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; quick-code: false; notranslate">
var searchSatisfactionObj = {
  &quot;event&quot;: &quot;_searchSatisfaction&quot;,
  &quot;properties&quot;: {
    &quot;key&quot;: &quot;imDMrs56aTaDJc6jihDejUkDZYj3Gm8riJHlR0V1S58&quot;,
    &quot;email&quot;: &quot;user1@demo.searchstax.com&quot;,
    &quot;score&quot;: 10,
    &quot;comments&quot;: &quot;Very good search experience&quot;,
    &quot;_vid&quot;: &quot;d7cc372a-2be6-ee1e-26e8-0f903fa36e67&quot;
  }
}
</pre></div>

<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Unique Analytics API Key.</td>
<td>&#8216;imDMrs56aTaDJc6jihDejUkDZYj3Gm8riJHlR0V1S58&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session.</td>
<td>&#8216;qqMKt4fxhcud0T5c3UJ5spgug&#8217;</td>
</tr>
<tr>
<td><strong>email:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>Email ID of the user submitting the feedback</td>
<td>&#8216;user123@demo.searchstax.com&#8217;</td>
</tr>
<tr>
<td><strong>comments:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>Feedback about the search experience as a comment</td>
<td>&#8216;Very good search experience&#8217;</td>
</tr>
<tr>
<td><strong>score:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>0-10 score, rating the search experience</td>
<td>10</td>
</tr>
<tr>
<td><strong>_vid</strong>:<br /><span class="has-inline-color" style="color: #32cd32;"><span class="has-inline-color" style="color: #ff0000;">required</span></span><br />string</td>
<td>Unique Identifier for the visitor</td>
<td>&#8220;d7cc372a-2be6-ee1e-26e8-0f903fa36e67&#8221;</td>
</tr>
</tbody>
</table>
</figure>


<p>To call the REST API and insert the event, the event object should be encoded to Base64 and passed as the <code>data</code>, just like for the _search event</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; quick-code: false; notranslate">
DATA = urlEncode(base64encode(searchSatisfactionObj))
curl -v &quot;https://analytics-us.searchstax.com/api/v2/track/?data=$DATA&quot;
</pre></div>


<p>The above method returns an HTTP status code of 201/204 if the event was successfully added.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading" id="questions">Questions?</h2>



<p>Do not hesitate to contact the <a href="mailto:support@demo.searchstax.com?subject=Studio%3A%20Tracking%20API%20%28REST%29" target="_blank" rel="noreferrer noopener">SearchStax Support Desk</a>.</p>
</div></div>
<p>The post <a href="https://demo.searchstax.com/docs/searchstudio/searchstax-studio-analytics-rest-api/">Tracking API (REST)</a> appeared first on <a href="https://demo.searchstax.com/docs">SearchStax Docs</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Analytics Cookies</title>
		<link>https://demo.searchstax.com/docs/searchstudio/analytics-cookies/</link>
		
		<dc:creator><![CDATA[Bruce]]></dc:creator>
		<pubDate>Thu, 13 Feb 2025 15:41:12 +0000</pubDate>
				<guid isPermaLink="false">https://demo.searchstax.com/docs/?post_type=searchstudio&#038;p=20607</guid>

					<description><![CDATA[<p>Site Search Cookie Usage SearchStax Site Search Analytics uses cookies to track the user’s search behavior. Site Search Analytics uses the following cookies: Name Purpose ms_visitorid This cookie is used&#8230; <a class="more-link" href="https://demo.searchstax.com/docs/searchstudio/analytics-cookies/">Continue reading <span class="screen-reader-text">Analytics Cookies</span></a></p>
<p>The post <a href="https://demo.searchstax.com/docs/searchstudio/analytics-cookies/">Analytics Cookies</a> appeared first on <a href="https://demo.searchstax.com/docs">SearchStax Docs</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h1 class="wp-block-heading" id="h-site-search-cookie-usage">Site Search Cookie Usage</h1>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p>SearchStax Site Search Analytics uses cookies to track the user’s search behavior. Site Search Analytics uses the following cookies:</p>



<figure class="wp-block-table table table-bordered table-striped"><table class="has-fixed-layout"><thead><tr><td>Name</td><td>Purpose</td></tr></thead><tbody><tr><td><code>ms_visitorid</code></td><td>This cookie is used to identify a user/visitor uniquely.</td></tr><tr><td><code>searchstax_session_id</code></td><td>This cookie is used to uniquely identify a user session. In an&nbsp; older toolkit (Legacy Vue2 accelerator), this cookie was named <code>searchcookie</code>).</td></tr></tbody></table></figure>
<p>The post <a href="https://demo.searchstax.com/docs/searchstudio/analytics-cookies/">Analytics Cookies</a> appeared first on <a href="https://demo.searchstax.com/docs">SearchStax Docs</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Tracking API (Javascript)</title>
		<link>https://demo.searchstax.com/docs/searchstudio/searchstax-studio-javascript-tracking-api/</link>
		
		<dc:creator><![CDATA[Bruce]]></dc:creator>
		<pubDate>Mon, 29 Mar 2021 16:25:00 +0000</pubDate>
				<guid isPermaLink="false">https://site-qa.searchstax.com/knowledgecenter/?post_type=site_search&#038;p=7901</guid>

					<description><![CDATA[<p>Analytics Javascript Tracking API This page describes how to add the SearchStax Site Search solution&#8217;s Analytics Events to the Javascript of your search page. This is a required step for&#8230; <a class="more-link" href="https://demo.searchstax.com/docs/searchstudio/searchstax-studio-javascript-tracking-api/">Continue reading <span class="screen-reader-text">Tracking API (Javascript)</span></a></p>
<p>The post <a href="https://demo.searchstax.com/docs/searchstudio/searchstax-studio-javascript-tracking-api/">Tracking API (Javascript)</a> appeared first on <a href="https://demo.searchstax.com/docs">SearchStax Docs</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h1 class="wp-block-heading" id="search-analytics-api">Analytics Javascript Tracking API </h1>



<hr class="wp-block-separator has-css-opacity"/>



<p>This page describes how to add the SearchStax Site Search solution&#8217;s <strong>Analytics Events</strong> to the Javascript of your search page. This is a required step for tracking user events. The events, in turn, make it possible to test the effect of proposed changes to your site.</p>



<h2 class="wp-block-heading" id="contents-of-this-page">Contents of this page:</h2>



<ul class="wp-block-list">
<li><a href="#javascript-library">Javascript Library</a></li>



<li><a href="#events">Events</a></li>



<li><a href="#search-events-vs-related-search-events">Search Events vs Related Search Events</a></li>



<li><a href="#track-searches-and-impressions">Track Searches and Impressions</a></li>



<li><a href="#track-search-satisfaction">Track Search Satisfaction</a></li>



<li><a href="#debug-analytics">Debugging the Analytics API</a></li>
</ul>



<h2 class="wp-block-heading" id="javascript-library">Javascript Library</h2>



<p>Your search page would track searches, clicks, and user feedback and send the information to your Search App.</p>



<p>Paste the following script in the head section of your Search Page:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; auto-links: false; title: ; notranslate">
 &lt;script type=&quot;text/javascript&quot;&gt;
    var _msq = _msq || &#x5B;]; //declare object
    var analyticsBaseUrl = &#039;https://app.searchstax.com&#039;;
    var 
    (function () {
      var ms = document.createElement(&quot;script&quot;);
      ms.type = &quot;text/javascript&quot;;
      ms.src = &quot;https://static.searchstax.com/studio-js/v3/js/studio-analytics.js&quot;;
      var s = document.getElementsByTagName(&quot;script&quot;)&#x5B;0];
      s.parentNode.insertBefore(ms, s);
    })();
 &lt;/script&gt;

</pre></div>


<p>Change the <code>'analyticsBaseUrl'</code> based on the Analytics Endpoint <strong>shown in on Site Search > App Settings > All APIs ></strong> <a href="https://demo.searchstax.com/docs/searchstudio/searchstax-studio-analytics-api-tab/">Analytics</a>.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="638" height="236" src="https://demo.searchstax.com/docs/wp-content/uploads/2021/03/image-90.png" alt="" class="wp-image-20952" srcset="https://demo.searchstax.com/docs/wp-content/uploads/2021/03/image-90.png 638w, https://demo.searchstax.com/docs/wp-content/uploads/2021/03/image-90-300x111.png 300w" sizes="(max-width: 638px) 100vw, 638px" /></figure>



<p>&nbsp;&nbsp;</p>



<h2 class="wp-block-heading" id="events">Events</h2>



<p>An &#8220;event&#8221; is a user action on your search page, such as searching for a keyword or clicking on a search result. SearchStax supports the following event messages:</p>



<ul class="wp-block-list">
<li><a href="#track-searches-and-impressions">track (to track queries)</a></li>



<li><a href="#track-related-searches-and-impressions">trackRelatedSearch</a></li>



<li><a href="#track-clicks">trackClick</a></li>



<li><a href="#track-related-search-clicks">trackRelatedSearchClick</a></li>



<li><a href="#track-search-satisfaction">trackSearchSatisfaction</a></li>
</ul>



<p>An event message is a wrapper for a list of property-value pairs. The values are the data that SearchStax tracks and analyzes. </p>



<p>Each type of event has its own set of required properties, which are detailed below. The following are the common properties across all events:</p>


<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string  </td>
<td>This is the unique analytics app key as shown in the “Analytics API” tab of your App within Search App Management</td>
<td>&#8216;4Qp1Sv9MnALbAGbixW9ZaWrHxpbfwm6&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string  </td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session. If omitted, some analytics features cannot be fully reported.</td>
<td>‘XDJFNS355FGDFVVDFG’</td>
</tr>
</tbody>
</table>
</figure>


<p>&nbsp;&nbsp;</p>



<h2 class="wp-block-heading" id="search-events-vs-related-search-events">Search Events vs Related Search Events</h2>



<p>The &#8220;search&#8221; and &#8220;related-search&#8221; events are intended to be used in the following fashion:</p>



<ol class="wp-block-list">
<li>Your search page sends a query to the search API. The search results are returned. A <a href="#track-searches-and-impressions">track</a> event fires to track the impressions from the search results.</li>



<li>If using the related searches features, your search page sends a request to the related searches API to get related searches for the query. The related searches are returned. A <a href="#track-related-searches-and-impressions">trackRelatedSearch</a> event fires to track the related searches that were returned</li>



<li>If the user clicks on a document, a <a href="#track-clicks">trackClick</a> event fires to track which document was clicked on.</li>



<li>If the user clicks on a related search, a <a href="#track-related-search-clicks">trackRelatedSearchClick</a> event fires to track which related search was clicked on. </li>
</ol>



<p>&nbsp;&nbsp;</p>



<h2 class="wp-block-heading" id="track-searches-and-impressions">Track Searches and Impressions</h2>



<p>To track searches, use <strong>_msq.push()</strong> and dispatch a <strong>track</strong> event as part of parsing the response document.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; auto-links: false; title: ; notranslate">
_msq.push(&#x5B;&#039;track&#039;, { 
   key: &quot;4Qp1Sv9MnALbAGbixW9ZaWrHxpbfwm6i&quot;, 
   user: &quot;smith123&quot;, 
   session: &quot;XDJFNS355FGDFVVDFG&quot;, 
   query: &quot;sitecore plugin&quot;, 
   shownHits: 10, 
   totalHits: 1890, 
   latency: 150, 
   pageNo: 1, 
   impressions: impressions,
   language: &quot;en&quot;
}]);

</pre></div>

<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Unique Analytics API Key</td>
<td>&#8216;4Qp1Sv9MnALbAGbixW9ZaWrHxpbfwm6i&#8217;</td>
</tr>
<tr>
<td><strong>user:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>A token identifying the webpage user. This datum is stored but is not currently used.</td>
<td>&#8216;smith123&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session.</td>
<td>&#8216;XDJFNS355FGDFVVDFG&#8217;</td>
</tr>
<tr>
<td><strong>query:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The query string from your search page, or <strong>q</strong> from the response document.</td>
<td>&#8216;sitecore plugin&#8217;</td>
</tr>
<tr>
<td><strong>shownHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits shown in the response document.</td>
<td>10</td>
</tr>
<tr>
<td><strong>totalHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits in the index, from the response document.</p>
<p><strong>Note:</strong> To track searches that returned no results, set totalHits to 0.</p>
</td>
<td>1890</td>
</tr>
<tr>
<td><strong>latency:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of milliseconds to execute a search. You define the semantics. (One possibility is to use Qtime from the response document). Without this value, Analytics will not calculate average latency.</td>
<td>150</td>
</tr>
<tr>
<td><strong>pageNo:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The page number of the displayed results, from the response document.</td>
<td>1</td>
</tr>
<tr>
<td><strong>impressions:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />array</td>
<td>An array of dictionaries, each describing a search result &#8220;impression.&#8221;</td>
<td>This is required if you would like to track impressions. See the example below.</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="/docs/searchstudio/searchstax-studio-multi-language-experiences/#default">default language</a>.</td>
<td>&#8220;en&#8221;, &#8220;fr&#8221;, or &#8220;es&#8221;</td>
</tr>
</tbody>
</table>
</figure>


<p>The optional array of impression dictionaries lets the Analytics App track the documents that were displayed to the user as search results, whether the user clicked on them or not. Use a javascript array to catalog the search results in the following format:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
var impressions = &#x5B;
   {&#039;cDocId&#039;: &#039;aDocId1&#039;, &#039;cDocTitle&#039;: &#039;aDocTitle1&#039;, &#039;position&#039;: 1},
   {&#039;cDocId&#039;: &#039;aDocId2&#039;, &#039;cDocTitle&#039;: &#039;aDocTitle2&#039;, &#039;position&#039;: 2},
];

</pre></div>


<p>where <strong>aDocId1</strong> is the ID of the document in position 1 and <strong>aDocTitle1</strong> is the title of the document in position 1. The <strong>position</strong> parameter is the absolute position of the document in the <em>full result list</em>. (If we&#8217;re showing ten items per page, the first result on the fifth page is in position 41.)</p>



<p>For example, your application might respond to a query by (1) passing the query to Solr, (2) parsing the result document, and (3) generating a search-page update containing a script like this one at the end of the &lt;body&gt; section:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; auto-links: false; title: ; notranslate">
&lt;script&gt;
    var track = {
    &quot;key&quot;: &quot;imDMrs56aTaDJc6jihDejUkDZYj3Gm8riJHlR0&quot;,
    &quot;query&quot;: &quot;sitecore&quot;,
    &quot;shownHits&quot;: 3,
    &quot;totalHits&quot;: 12,
    &quot;pageNo&quot;: 1,
    &quot;latency&quot;: 1,
    &quot;session&quot;: &quot;Ll5UDHUQHccphnlb7lp6sQIo5&quot;,
    &quot;language&quot;: &quot;en&quot;,
    &quot;impressions&quot;: &#x5B;
      {&quot;cDocId&quot;: &quot;https://www.searchstax.com/videos/solr-cloud-best-practices-sitecore/&quot;,
        &quot;cDocTitle&quot;: &quot;Sitecore Solr Best Practices - SolrCloud SUGLA Meetup | SearchStax&quot;,
        &quot;position&quot;: 1
      },
      {
        &quot;cDocId&quot;: &quot;https://www.searchstax.com/solutions/sitecore-solr/&quot;,
        &quot;cDocTitle&quot;: &quot;Sitecore Solr Search: Get fast and relevant search results | SearchStax&quot;,
        &quot;position&quot;: 2
      },
      {
        &quot;cDocId&quot;: &quot;https://www.searchstax.com/case-studies/sitecore-solr-search-azure-isango/&quot;,
        &quot;cDocTitle&quot;: &quot;Case Study Isango!&quot;,
        &quot;position&quot;: 3
      }
    ],
  }}
    if(track.query != &#039;&#039;) {
        _msq.push(&#x5B;&#039;track&#039;, track]);
}
&lt;/script&gt;


</pre></div>


<p>In this way, your application can push a description of the search to your Analytics App by automatically calling the <strong>_msq.push()</strong> function as soon as the updated search page is viewed by the user.</p>



<p>&nbsp;&nbsp;</p>



<p>&nbsp;&nbsp;</p>



<p>&nbsp;&nbsp;</p>



<h2 class="wp-block-heading" id="track-related-searches-and-impressions">Track Related Searches and Impressions</h2>



<p>To track related searches, use <strong>_msq.push()</strong> and dispatch a <strong>trackRelatedSearch</strong> event as part of parsing the response document.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
_msq.push(&#x5B;&#039;trackRelatedSearch&#039;, { 
   key: &quot;4Qp1Sv9MnALbAGbixW9ZaWrHxpbfwm6i&quot;, 
   user: &quot;smith123&quot;, 
   session: &quot;XDJFNS355FGDFVVDFG&quot;, 
   query: &quot;sitecore plugin&quot;, 
   shownHits: 10, 
   latency: 150, 
   impressions: impressions,
   language: &quot;en&quot;
   
}]);

</pre></div>

<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Unique Analytics API Key</td>
<td>&#8216;4Qp1Sv9MnALbAGbixW9ZaWrHxpbfwm6i&#8217;</td>
</tr>
<tr>
<td><strong>user:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>A token identifying the webpage user. This datum is stored but is not currently used.</td>
<td>&#8216;smith123&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session.</td>
<td>&#8216;XDJFNS355FGDFVVDFG&#8217;</td>
</tr>
<tr>
<td><strong>query:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The query string from your search page, or <strong>q</strong> from the response document.</td>
<td>&#8216;sitecore plugin&#8217;</td>
</tr>
<tr>
<td><strong>shownHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits shown in the response document.</td>
<td>10</td>
</tr>
<tr>
<td><strong>latency:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of milliseconds to execute a search. You define the semantics. (One possibility is to use Qtime from the response document). Without this value, Analytics will not calculate average latency.</td>
<td>150</td>
</tr>
<tr>
<td><strong>impressions:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />array</td>
<td>An array of dictionaries, each describing a search result &#8220;impression.&#8221;</td>
<td>This is required if you would like to track impressions. See the example below.</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="/docs/searchstudio/searchstax-studio-multi-language-experiences/#default">default language</a>.</td>
<td>&#8220;en&#8221;, &#8220;fr&#8221;, or &#8220;es&#8221;</td>
</tr>
</tbody>
</table>
</figure>


<p>The optional array of impression dictionaries lets the Analytics App track the&nbsp;related searches&nbsp;that were displayed to the user as&nbsp;related&nbsp;search results, whether the user clicked on them or not. Use a javascript array to catalog the&nbsp;related&nbsp;search results in the following format</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
var impressions = &#x5B;
   {&#039;relatedSearch&#039;: &#039;relatedTerm1&#039;, &#039;position&#039;: 1},
   {&#039;relatedSearch&#039;: &#039;relatedTerm2&#039;, &#039;position&#039;: 2},
];

</pre></div>


<p>where&nbsp;<strong>relatedTerm1</strong>&nbsp;is the returned related search term in position 1.</p>



<p>&nbsp;&nbsp;</p>



<p>&nbsp;&nbsp;</p>



<h2 class="wp-block-heading" id="track-clicks">Track Clicks</h2>



<p>To start generating data around click-through events, search quality and relevance, have <strong>_msq.push()</strong> send <strong>trackClick</strong> events to the Analytics App.</p>



<p>In your search-results page, add an <strong>on-click</strong> event in the link to each search result.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; auto-links: false; title: ; notranslate">
_msq.push(&#x5B;&#039;trackClick&#039;, { 
   session: &#039;Ll5UDHUQHccphnlb7lp6sQIo5&#039;, 
   key: &#039;imDMrs56aTaDJc6jihDejUkDZYj3Gm8riJHlR0&#039;, 
   query: &#039;sitecore&#039;, 
   position: 2, 
   cDocId: &#039;https://www.searchstax.com/solutions/sitecore-solr/&#039;, 
   cDocTitle: &#039;Sitecore Solr Search: Get fast and relevant search results | SearchStax&#039;, 
   pageNo: 1, 
   shownHits: 3, 
   totalHits: 12,
   language: &quot;en&quot;
}]);

</pre></div>

<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Unique Analytics API Key</td>
<td>&#8216;4Qp1Sv9MnALbAGbixW9ZaWrHxpbfwm6i&#8217;</td>
</tr>
<tr>
<td><strong>user:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>A token identifying the webpage user. This datum is stored but is not currently used.</td>
<td>&#8216;smith123&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session.</td>
<td>&#8216;XDJFNS355FGDFVVDFG&#8217;</td>
</tr>
<tr>
<td><strong>query:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The query string from your search page, or <strong>q</strong> from the response document.</td>
<td>&#8216;sitecore plugin&#8217;</td>
</tr>
<tr>
<td><strong>cDocId:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The document ID from the response document.</td>
<td>&#8216;<a href="/solutions/sitecore-solr/">https://www.searchstax.com/solutions/sitecore-solr/</a>&#8216;</td>
</tr>
<tr>
<td><strong>cDocTitle</strong><br /><span class="has-inline-color" style="color: #32cd32;"><span class="has-inline-color" style="color: #ff0000;">required</span></span><br />string</td>
<td>The document title from the response document. Note: In some applications, the document title may change. Analytics can be calculated as long as cDocID remains constant.</td>
<td>&#8216;Sitecore Solr Search: Get fast and relevant search results | SearchStax&#8217;</td>
</tr>
<tr>
<td><strong>position:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />number</td>
<td>Absolute position of the document in the full list of results. If we&#8217;re showing ten items per page, the first result on the 5th page is position in position 41. First item on the first page has position as 1</td>
<td>41</td>
</tr>
<tr>
<td><strong>pageNo:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The page number of the displayed results, from the response document.</td>
<td>1</td>
</tr>
<tr>
<td><strong>pageUrl:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>The URL of the page that is sending the tracking request</td>
<td>&#8216;https://searchstudio.searchstax.com/search&#8217;</td>
</tr>
<tr>
<td><strong>shownHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits shown in the response document.</td>
<td>10</td>
</tr>
<tr>
<td><strong>totalHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits in the index, from the response document.</td>
<td>1890</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="/docs/searchstudio/searchstax-studio-multi-language-experiences/#default">default language</a>.</td>
<td>&#8220;en&#8221;, &#8220;fr&#8221;, or &#8220;es&#8221;</td>
</tr>
</tbody>
</table>
</figure>


<p>&nbsp;</p>



<p>&nbsp;&nbsp;</p>



<h2 class="wp-block-heading" id="track-related-search-clicks">Track Related Search Clicks</h2>



<p>To start generating data around click-through events, search quality and relevance, have <strong>_msq.push()</strong> send <strong>trackRelatedSearchClick</strong> events to the Analytics App.</p>



<p>In your search-results page, add an <strong>on-click</strong> event in the link to each search result.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; auto-links: false; title: ; notranslate">
_msq.push(&#x5B;&#039;trackRelatedSearchClick&#039;, { 
   session: &#039;Ll5UDHUQHccphnlb7lp6sQIo5&#039;, 
   key: &#039;imDMrs56aTaDJc6jihDejUkDZYj3Gm8riJHlR0&#039;, 
   query: &#039;sitecore&#039;, 
   position: 2, 
   relatedSearch: &#039;sitecore 7&#039;, 
   pageNo: 1, 
   shownHits: 3, 
   totalHits: 12,
   language: &quot;en&quot;
}]);

</pre></div>

<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Unique Analytics API Key</td>
<td>&#8216;4Qp1Sv9MnALbAGbixW9ZaWrHxpbfwm6i&#8217;</td>
</tr>
<tr>
<td><strong>user:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>A token identifying the webpage user. This datum is stored but is not currently used.</td>
<td>&#8216;smith123&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session.</td>
<td>&#8216;XDJFNS355FGDFVVDFG&#8217;</td>
</tr>
<tr>
<td><strong>query:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The query string from your search page, or <strong>q</strong> from the response document.</td>
<td>&#8216;sitecore plugin&#8217;</td>
</tr>
<tr>
<td><strong>position:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />number</td>
<td>Absolute position of the related search in the full list of results. If we’re showing ten related searches per page, the first related search on the 5th page is position in position 41. First related search on the first page has position as 1</td>
<td>41</td>
</tr>
<tr>
<td><strong>relatedSearch:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>The related search term that was clicked on.</td>
<td>&#8216;sitecore 7&#8217;</td>
</tr>
<tr>
<td><strong>pageNo:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The page number of the displayed results, from the response document.</td>
<td>1</td>
</tr>
<tr>
<td><strong>pageUrl:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>The URL of the page that is sending the tracking request</td>
<td>&#8216;https://searchstudio.searchstax.com/search&#8217;</td>
</tr>
<tr>
<td><strong>shownHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits shown in the response document.</td>
<td>10</td>
</tr>
<tr>
<td><strong>totalHits:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />number</td>
<td>The number of hits in the index, from the response document.</td>
<td>1890</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="/docs/searchstudio/searchstax-studio-multi-language-experiences/#default">default language</a>.</td>
<td>&#8220;en&#8221;, &#8220;fr&#8221;, or &#8220;es&#8221;</td>
</tr>
</tbody>
</table>
</figure>


<p>&nbsp;&nbsp;</p>



<p>&nbsp;</p>



<p>&nbsp;&nbsp;</p>



<h2 class="wp-block-heading" id="track-search-satisfaction">Track Search Satisfaction</h2>



<p>SearchStax provides the ability to collect qualitative feedback about the search experience using <strong>trackSearchSatisfaction</strong>.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; auto-links: false; title: ; notranslate">
_msq.push(&#x5B;&#039;trackSearchSatisfaction&#039;, {
    key: &#039;4Qp1Sv9MnALbAGbixW9ZaWrHxpbfwm6i&#039;,
    email: &#039;user1@demo.searchstax.com&#039;,
    score: 10,
    comments: &#039;Very good search experience&#039;,
    session: &#039;XDJFNS355FGDFVVDFG&#039;,
    language: &#039;en&#039;
}]);

</pre></div>

<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>Unique Analytics API Key.</td>
<td>&#8216;4Qp1Sv9MnALbAGbixW9ZaWrHxpbfwm6i&#8217;</td>
</tr>
<tr>
<td><strong>session:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>The ID of the <a href="https://stackoverflow.com/questions/920670/read-session-id-using-javascript">web session</a> or mobile application session.</td>
<td>&#8216;XDJFNS355FGDFVVDFG&#8217;</td>
</tr>
<tr>
<td><strong>email:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>Email ID of the user submitting the feedback</td>
<td>&#8216;user123@demo.searchstax.com&#8217;</td>
</tr>
<tr>
<td><strong>comments:</strong><br /><span class="has-inline-color" style="color: #32cd32;">optional</span><br />string</td>
<td>Feedback about the search experience as a comment</td>
<td>&#8216;Very good search experience&#8217;</td>
</tr>
<tr>
<td><strong>score:</strong><br /><span class="has-inline-color" style="color: #ff0000;">required</span><br />string</td>
<td>0-10 score, rating the search experience</td>
<td>10</td>
</tr>
</tbody>
</table>
</figure>


<p>The searchFeedback events are used to compute the NPS score (Net {Promoter Score) for your Search Application. </p>



<p>&nbsp;&nbsp;</p>



<p>&nbsp;&nbsp;</p>



<h2 id="debug-analytics">Debugging Analytics APIs</h2>



<p>You can use any browser debugging tools to debug the calls being made to the Analytics server. In Chrome, you can right click on the page, click on &#8220;Inspect&#8221; and look at the Network tab for calls made to the &#8216;analyticsBaseUrl&#8217;. Have &#8216;Preserve log&#8217; checked so you can track clicks as they open in new pages.</p>



<p>The Analytics APIs will look like:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; notranslate">
https://app.searchstax.com/api/v2/track/?data=eyJldmVudCI6Il9zZWFyY2hjbGljayIsInByb3BlcnRpZXMiOnsia2V5IjoiaW1ETXJzNTZhVGFESmM2amloRGVqVWtEWllqM0dtOHJpSkhsUjBWMVM1OCIsInF1ZXJ5Ijoic2l0ZWNvcmUiLCJzaG93bkhpdHMiOjksInRvdGFsSGl0cyI6MTMxLCJwYWdlTm8iOjEsImxhdGVuY3kiOjExLCJzZXNzaW9uIjoiNnNmN09GSWJRSlp1cU92ZU1VdUkyOW5SMSIsImNEb2NJZCI6Imh0dHBzOi8vd3d3LnNlYXJjaHN0YXguY29tL3NvbHV0aW9ucy9zaXRlY29yZS1zb2xyLyIsImNEb2NUaXRsZSI6IlNpdGVjb3JlIFNvbHIgU2VhcmNoOiBHZXQgZmFzdCBhbmQgcmVsZXZhbnQgc2VhcmNoIHJlc3VsdHMgfCBTZWFyY2hTdGF4IiwicG9zaXRpb24iOjEsIl92aWQiOiIxYzkwZWQ3MS1lZjljLTVlNjAtNGJlNS1jODI4OWYwMWJkYzkiLCJ0dCI6MTYxNzA2NjQwODAxMiwicGFnZVVybCI6Imh0dHBzJTNBJTJGJTJGd3d3LnNlYXJjaHN0YXguY29tJTJGc2VhcmNoJTNGc2VhcmNoU3R1ZGlvUXVlcnklM0RzaXRlY29yZSUyNnN0eWxlJTNEdHJ1ZSUyNmZhY2V0cyUzRCUyNnNvcnQlM0QlMjZzdGFydCUzRDAlMjZmYWNldENvbnRlbnQlMjUyMFR5cGUlM0QxJTI2ZmFjZXRBdXRob3IlM0QxJTI2ZmFjZXRLZXl3b3JkcyUzRDEifX0=
</pre></div>


<p>The argument to &#8220;data&#8221; is Base64 encoded properties. You can use online base64 decoders like <a href="https://www.base64decode.org/">https://www.base64decode.org/</a> to decode them to view the JSON data being passed</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading" id="questions">Questions?</h2>



<p>Do not hesitate to contact the <a href="mailto:support@demo.searchstax.com?subject=Studio%3A%20Tracking%20API%20%28Javascript%29" target="_blank" rel="noreferrer noopener">SearchStax Support Desk</a>.</p>
</div></div>
<p>The post <a href="https://demo.searchstax.com/docs/searchstudio/searchstax-studio-javascript-tracking-api/">Tracking API (Javascript)</a> appeared first on <a href="https://demo.searchstax.com/docs">SearchStax Docs</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Reporting API (REST)</title>
		<link>https://demo.searchstax.com/docs/searchstudio/searchstax-studio-reporting-api-rest/</link>
		
		<dc:creator><![CDATA[Bruce]]></dc:creator>
		<pubDate>Fri, 05 Aug 2022 20:27:45 +0000</pubDate>
				<guid isPermaLink="false">https://demo.searchstax.com/docs/?post_type=searchstudio&#038;p=12300</guid>

					<description><![CDATA[<p>Analytics Reporting REST API This page describes how a SearchStax Site Search solution Enterprise Plan client can use the&#160;SearchStax®&#160;Analytics Tracking REST API to retrieve search events and items from the&#8230; <a class="more-link" href="https://demo.searchstax.com/docs/searchstudio/searchstax-studio-reporting-api-rest/">Continue reading <span class="screen-reader-text">Reporting API (REST)</span></a></p>
<p>The post <a href="https://demo.searchstax.com/docs/searchstudio/searchstax-studio-reporting-api-rest/">Reporting API (REST)</a> appeared first on <a href="https://demo.searchstax.com/docs">SearchStax Docs</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h1 class="wp-block-heading" id="h-analytics-reporting-rest-api">Analytics Reporting REST API</h1>



<hr class="wp-block-separator has-css-opacity"/>



<p>This page describes how a SearchStax Site Search solution Enterprise Plan client can use the&nbsp;SearchStax<sup>®</sup>&nbsp;Analytics <strong>Tracking REST API</strong> to retrieve search events and items from the Search App.</p>



<p>The Tracking REST API can also perform <a href="/docs/searchstudio/serchstax-studio-power-search/">Custom Reports</a> searches.  </p>



<p></p>



<pre class="wp-block-preformatted">  </pre>



<p></p>



<h2 class="wp-block-heading" id="h-reporting-url-and-key">Reporting URL and Key</h2>



<p>Navigate to the <strong>Site Search &gt; App Settings &gt; All APIs &gt; Analytics</strong> screen. This screen displays the <strong>Analytics Reporting API Endpoint</strong> and the <strong>Analytics Reporting API Key</strong>. The key is used to identify the Search App.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="480" height="242" src="https://demo.searchstax.com/docs/wp-content/uploads/2022/08/image-67.png" alt="" class="wp-image-20982" srcset="https://demo.searchstax.com/docs/wp-content/uploads/2022/08/image-67.png 480w, https://demo.searchstax.com/docs/wp-content/uploads/2022/08/image-67-300x151.png 300w" sizes="(max-width: 480px) 100vw, 480px" /></figure></div>


<p>The <strong>Analytics Reporting API Endpoint</strong> is <strong>https://analytics-us.searchstax.com</strong>.</p>



<p></p>



<h2 class="wp-block-heading" id="h-reports">Reports</h2>



<p>The Analytics Reporting REST API supports the following reporting actions:</p>



<ul class="wp-block-list">
<li><a href="#h-report-searches">Searches</a> </li>



<li><a href="#h-report-items">Content Items</a></li>



<li><a href="#h-PS-searches">Custom Reports (Searches)</a></li>



<li><a href="#h-power-search-items">Custom Reports (Content Items)</a></li>
</ul>



<p>Each type of report has its own set of required properties, which are detailed below. </p>



<h2 class="wp-block-heading" id="h-report-searches">Report Searches</h2>



<p>To create a report of Most-Popular Searches, No-Result Searches, and No-Click Searches, use a cURL command in this general format:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; auto-links: false; title: ; quick-code: false; notranslate">
curl &#039;&lt;Reporting API Endpoint&gt;/api/rest/analytics/v1/reporting/searches/searches&#039; -H &#039;authorization: Token &lt;Key&gt;&#039;
</pre></div>


<p>A fully-expanded example resembles this:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; auto-links: false; title: ; quick-code: false; notranslate">
curl &#039;https://analytics-us.searchstax.com/api/rest/analytics/v1/reporting/searches/searches?&amp;startDate=2022-02-06T07:00:00&amp;endDate=2022-02-28T06:59:59&amp;offset=0&amp;limit=10&amp;language=en&#039; -H &#039;authorization: Token 4Qp1Sv9MnALbAGbixW9ZaW95338fwm6i&#039;
</pre></div>


<p></p>


<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>Unique Analytics Reporting API Key</td>
<td>4Qp1Sv9MnALbAGbixW9ZaW95338fwm6i</td>
</tr>
<tr>
<td><strong>startDate:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;"><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark></mark><br />datetime</td>
<td>The date and time (UTC) of the earliest events in the report. Defaults to the last 31 days.</td>
<td>2022-02-06T07:00:00</td>
</tr>
<tr>
<td><strong>endDate:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>The date and time (UTC) of the latest events in the report. Default to the last 31 days. Max end date is 31 days after the start date.</td>
<td>2022-02-28T06:59:59</td>
</tr>
<tr>
<td><strong>offset:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;"><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark></mark><br />number</td>
<td>This index begins at 0. It is used for how far down in the results for most popular searches, no result searches, and searches with no clicks tables to start collecting in the report. Defaults to 0.</td>
<td>0</td>
</tr>
<tr>
<td><strong>limit:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />number</td>
<td>This number begins at 0. It is used for how far down in the results for most popular searches, no result searches, and searches with no clicks tables to end the collection of data in the report.Defaults to the end of the results.</td>
<td>10</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="/docs/searchstudio/searchstax-studio-multi-language-experiences/#default">default language</a>.</td>
<td>en</td>
</tr>
</tbody>
</table>
</figure>


<p>The returned value is a JSON document describing searches. The parameters map into the values shown in the Site Search <a href="/docs/searchstudio/searchstax-studio-searches/">Searches</a> screen. A partial sample is shown below.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; quick-code: false; notranslate">
{
  &quot;aggMetrics&quot;: &#x5B;
    {
      &quot;resultSearchCount&quot;: 58,
      &quot;totalSearchCount&quot;: 61,
      &quot;clickThroughRate&quot;: 36.0655737704918,
      &quot;clickCount&quot;: 21,
      &quot;sessionCount&quot;: 7,
      &quot;sessionWithSearchCount&quot;: 6,
      &quot;sessionWithSearchPercent&quot;: 85.71428571428571,
      &quot;avgClickPosition&quot;: 2.380952380952381,
      &quot;meanReciprocalRank&quot;: 0.6373015873015873,
      &quot;noResultSearchCount&quot;: 3,
      &quot;noResultSearchPercent&quot;: 4.918032786885246,
      &quot;searchWithClickCount&quot;: 22,
      &quot;searchExitCount&quot;: 1,
      &quot;searchExitPercent&quot;: 14.285714285714285,
      &quot;searchPerSessionCount&quot;: 8.714285714285714,
      &quot;startDate&quot;: &quot;2022-02-06T07:00:00+00:00&quot;,
      &quot;endDate&quot;: &quot;2022-02-28T06:59:59+00:00&quot;
    }
  ],
  &quot;topNoClickSearches&quot;: &#x5B;
    {
      &quot;searchCount&quot;: 6,
      &quot;sumClicks&quot;: 0,
      &quot;clickThroughRate&quot;: 0,
      &quot;avgLatency&quot;: 21.166666666666668,
      &quot;avgHits&quot;: 403,
      &quot;query&quot;: &quot;search&quot;,
      &quot;ofTotal&quot;: 9.836065573770492
    },
    {
      &quot;searchCount&quot;: 5,
      &quot;sumClicks&quot;: 0,
      &quot;clickThroughRate&quot;: 0,
      &quot;avgLatency&quot;: 121.2,
      &quot;avgHits&quot;: 80,
      &quot;query&quot;: &quot;drupal&quot;,
      &quot;ofTotal&quot;: 8.19672131147541
    },
    {
      &quot;searchCount&quot;: 5,
      &quot;sumClicks&quot;: 0,
      &quot;clickThroughRate&quot;: 0,
      &quot;avgLatency&quot;: 18.4,
      &quot;avgHits&quot;: 173,
      &quot;query&quot;: &quot;sitecore plugin&quot;,
      &quot;ofTotal&quot;: 8.19672131147541
    },

</pre></div>


<h2 class="wp-block-heading" id="h-report-content-items">Report Content Items</h2>



<p>To create a report of Most-Clicked and Least-Clicked Content Items, use a cURL command in this general format:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; auto-links: false; title: ; quick-code: false; notranslate">
curl &#039;&lt;Analytics Reporting API Endpoint&gt;/api/rest/analytics/v1/reporting/clicks/clicks&#039; -H &#039;authorization: Token &lt;Key&gt;&#039; 
</pre></div>


<p>A fully-expanded example resembles this:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; auto-links: false; title: ; quick-code: false; notranslate">
curl &#039;https://analytics-us.searchstax.com/api/rest/analytics/v1/reporting/clicks/clicks?&amp;startDate=2022-02-06T07:00:00&amp;endDate=2022-02-28T06:59:59&amp;offset=0&amp;limit=10&amp;language=en&#039; -H &#039;authorization: Token V3B2XGcj9nmA8cMJiEp5UURb1eZzQMiKL953384dszU&#039;
</pre></div>


<p></p>


<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>Unique Analytics Reporting API Key</td>
<td>4Qp1Sv9MnALbAGbixW9ZaW95338fwm6i</td>
</tr>
<tr>
<td><strong>startDate:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;"><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark></mark><br />datetime</td>
<td>The date and time (UTC) of the earliest events in the report. Defaults to the last 31 days.</td>
<td>2022-02-06T07:00:00</td>
</tr>
<tr>
<td><strong>endDate:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>The date and time (UTC) of the latest events in the report. Default to the last 31 days. Max end date is 31 days after the start date.</td>
<td>2022-02-28T06:59:59</td>
</tr>
<tr>
<td><strong>offset:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;"><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark></mark><br />number</td>
<td>This index begins at 0. It is used for how far down in the results for most popular searches, no result searches, and searches with no clicks tables to start collecting in the report. Defaults to 0.</td>
<td>0</td>
</tr>
<tr>
<td><strong>limit:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />number</td>
<td>This number begins at 0. It is used for how far down in the results for most popular searches, no result searches, and searches with no clicks tables to end the collection of data in the report.Defaults to the end of the results.</td>
<td>10</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="/docs/searchstudio/searchstax-studio-multi-language-experiences/#default">default language</a>.</td>
<td>en</td>
</tr>
</tbody>
</table>
</figure>


<p>The returned value is a JSON document describing items. The parameters map into the values shown in the Site Search <a href="/docs/searchstudio/searchstax-studio-items/">Content Items</a> screen. A partial sample is shown below.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; quick-code: false; notranslate">
{
  &quot;aggMetrics&quot;: &#x5B;
    {
      &quot;impressionCount&quot;: 663,
      &quot;clickCount&quot;: 21,
      &quot;contentClickThroughRate&quot;: 3.167420814479638,
      &quot;avgClickPosition&quot;: 2.380952380952381,
      &quot;startDate&quot;: &quot;2022-02-06T07:00:00+00:00&quot;,
      &quot;endDate&quot;: &quot;2022-02-28T06:59:59+00:00&quot;
    }
  ],
  &quot;mostClicked&quot;: &#x5B;
    {
      &quot;clickCount&quot;: 1,
      &quot;ofTotal&quot;: 4.761904761904762,
      &quot;cDocId&quot;: &quot;095c1ffe-d2bb-4bc3-82ae-8c13075e5021&quot;,
      &quot;cDocTitle&quot;: &quot;Microsoft Azure | SearchStax Partners&quot;,
      &quot;impressionCount&quot;: 2,
      &quot;contentClickThroughRate&quot;: 50,
      &quot;avgClickPosition&quot;: 2
    },
    {
      &quot;clickCount&quot;: 1,
      &quot;ofTotal&quot;: 4.761904761904762,
      &quot;cDocId&quot;: &quot;0a13ade1-da89-4a78-9531-50efacfc48b4&quot;,
      &quot;cDocTitle&quot;: &quot;Sitecore 10.0 - SearchStax Docs&quot;,
      &quot;impressionCount&quot;: 7,
      &quot;contentClickThroughRate&quot;: 14.285714285714285,
      &quot;avgClickPosition&quot;: 5
    },
    {
      &quot;clickCount&quot;: 1,
      &quot;ofTotal&quot;: 4.761904761904762,
      &quot;cDocId&quot;: &quot;1115779e-6aa5-456c-bb39-2a372c589bd6&quot;,
      &quot;cDocTitle&quot;: &quot;Solr Version Policy | SearchStax&quot;,
      &quot;impressionCount&quot;: 1,
      &quot;contentClickThroughRate&quot;: 100,
      &quot;avgClickPosition&quot;: 3
    },


</pre></div>


<h2 class="wp-block-heading" id="h-custom-reports-searches">Custom Reports (Searches)</h2>



<p>To perform a Custom Reports search of Searches using the REST API, use a cURL command in this general format:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; auto-links: false; title: ; quick-code: false; notranslate">
curl &#039;&lt;Reporting API Endpoint&gt;/api/rest/analytics/v1/reporting/searches/power-search/searches?&amp;filterName=&lt;Filter Name&gt;&amp;filterOperator=&lt;Filter Operator&gt;&amp;filterValue=&lt;Filter Value&gt;&amp;ordering=&lt;Ordering&gt;&#039; -H &#039;authorization: Token &lt;Key&gt;&#039;  
</pre></div>


<p>A fully-expanded example resembles this:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; auto-links: false; title: ; quick-code: false; notranslate">
curl &#039;https://analytics-us.searchstax.com/api/rest/analytics/v1/reporting/searches/power-search/searches?filterName=clickThroughRate&amp;filterOperator=gt&amp;filterValue=3&amp;ordering=-clickThroughRate&amp;startDate=2022-02-06T07:00:00&amp;endDate=2022-02-28T06:59:59&amp;offset=0&amp;limit=10&amp;language=en&#039; -H &#039;authorization: Token V3B2XGcj9nmA8cMJiEp5UURb1eZzQMiKL953384dszU&#039;
</pre></div>


<p>Note that you can use up to three <strong>filterName=&#8221;name&#8221;&amp;filterOperator=&#8221;operator&#8221;&amp;filterValue=&#8221;value&#8221;</strong> constructions in sequence to apply multiple filters. </p>


<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>Unique Analytics Reporting API Key</td>
<td>4Qp1Sv9MnALbAGbixW9ZaW95338fwm6i</td>
</tr>
<tr>
<td><strong>filterName:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>The name of the filter as seen on the <a href="/docs/searchstudio/serchstax-studio-power-search/">Custom Reports</a> screen.</td>
<td>clickThroughRate<br />avgHits<br />searchCount<br />sumClicks<br />avgClickPosition<br />avgLatency</td>
</tr>
<tr>
<td><strong>filterOperator</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>The filter operator to be applied. Must appear between filterName and filterValue.</td>
<td>gt<br />gte<br />lt<br />lte<br />eq</td>
</tr>
<tr>
<td><strong>filterValue</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />number</td>
<td>The value that the filter will test.</td>
<td>50</td>
</tr>
<tr>
<td><strong>ordering</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>The results are ordered by the filterName specified. This defaults to sort by ascending. Applying a ‘-’ before the filterName will produce a descending sort.</td>
<td>-clickThroughRate</td>
</tr>
<tr>
<td><strong>startDate:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;"><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark></mark><br />datetime</td>
<td>The date and time (UTC) of the earliest events in the report. Defaults to the last 31 days.</td>
<td>2022-02-06T07:00:00</td>
</tr>
<tr>
<td><strong>endDate:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>The date and time (UTC) of the latest events in the report. Default to the last 31 days. Max end date is 31 days after the start date.</td>
<td>2022-02-28T06:59:59</td>
</tr>
<tr>
<td><strong>offset:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;"><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark></mark><br />number</td>
<td>This index begins at 0. It is used for how far down in the results for most popular searches, no result searches, and searches with no clicks tables to start collecting in the report. Defaults to 0.</td>
<td>0</td>
</tr>
<tr>
<td><strong>limit:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />number</td>
<td>This number begins at 0. It is used for how far down in the results for most popular searches, no result searches, and searches with no clicks tables to end the collection of data in the report. Defaults to the end of the results.</td>
<td>10</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="/docs/searchstudio/searchstax-studio-multi-language-experiences/#default">default language</a>.</td>
<td>en</td>
</tr>
</tbody>
</table>
</figure>


<p>The returned value is a JSON document describing searches. The parameters map into the values shown in the Site Search <a href="/docs/searchstudio/serchstax-studio-power-search/">Custom Reports</a> screen. A partial sample is shown below.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; quick-code: false; notranslate">
{
  &quot;results&quot;: &#x5B;
    {
      &quot;searchCount&quot;: 1,
      &quot;sumClicks&quot;: 3,
      &quot;clickThroughRate&quot;: 100,
      &quot;avgLatency&quot;: 34,
      &quot;avgHits&quot;: 67,
      &quot;query&quot;: &quot;partner&quot;,
      &quot;ofTotal&quot;: 1.639344262295082,
      &quot;avgClickPosition&quot;: 2.3333333333333335
    },
    {
      &quot;searchCount&quot;: 1,
      &quot;sumClicks&quot;: 2,
      &quot;clickThroughRate&quot;: 100,
      &quot;avgLatency&quot;: 39,
      &quot;avgHits&quot;: 35,
      &quot;query&quot;: &quot;private&quot;,
      &quot;ofTotal&quot;: 1.639344262295082,
      &quot;avgClickPosition&quot;: 2.5
    },
    {
      &quot;searchCount&quot;: 1,
      &quot;sumClicks&quot;: 3,
      &quot;clickThroughRate&quot;: 100,
      &quot;avgLatency&quot;: 69,
      &quot;avgHits&quot;: 432,
      &quot;query&quot;: &quot;solr&quot;,
      &quot;ofTotal&quot;: 1.639344262295082,
      &quot;avgClickPosition&quot;: 2
    },


</pre></div>


<h2 class="wp-block-heading" id="h-custom-reports-content-items">Custom Reports (Content Items)</h2>



<p>To perform an Custom Reports search of Content Items using the REST API, use a cURL command in this general format:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; auto-links: false; title: ; quick-code: false; notranslate">
curl &#039;&lt;Reporting API Endpoint&gt;/api/rest/analytics/v1/reporting/clicks/power-search/clicks?&amp;filterName=&lt;Filter Name&gt;&amp;filterOperator=&lt;Filter Operator&gt;&amp;filterValue=&lt;Filter Value&gt;&amp;ordering=&lt;Ordering&gt;&#039; -H &#039;authorization: Token &lt;Key&gt;&#039;  
</pre></div>


<p>A fully-expanded example resembles this:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; auto-links: false; title: ; quick-code: false; notranslate">
curl &#039;https://analytics-us.searchstax.com/api/rest/analytics/v1/reporting/clicks/power-search/clicks?filterName=contentClickThroughRate&amp;filterOperator=lte&amp;filterValue=20&amp;ordering=-contentClickThroughRate&amp;startDate=2022-02-06T07:00:00&amp;endDate=2022-02-28T06:59:59&amp;offset=0&amp;limit=10&amp;language=en&#039; -H &#039;authorization: Token V3B2XGcj9nmA8cMJiEp5UURb1eZzQMiKL953384dszU&#039;
</pre></div>


<p>Note that you can use up to three <strong>filterName=&#8221;name&#8221;&amp;filterOperator=&#8221;operator&#8221;&amp;filterValue=&#8221;value&#8221;</strong> constructions in sequence to apply multiple filters. </p>


<figure class="wp-block-table table table-bordered table-striped">
<table>
<thead>
<tr>
<th><strong>Parameter</strong></th>
<th><strong>Description</strong></th>
<th><strong>Example</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>key:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>Unique Analytics Reporting API Key</td>
<td>4Qp1Sv9MnALbAGbixW9ZaW95338fwm6i</td>
</tr>
<tr>
<td><strong>filterName:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>The name of the filter as seen on the <a href="/docs/searchstudio/serchstax-studio-power-search/">Power Search</a> screen.</td>
<td>contentClickThroughRate<br />impressionCount<br />clickCount</td>
</tr>
<tr>
<td><strong>filterOperator</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>The filter operator to be applied. Must appear between filterName and filterValue.</td>
<td>gt<br />gte<br />lt<br />lte<br />eq</td>
</tr>
<tr>
<td><strong>filterValue</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />number</td>
<td>The value that the filter will test.</td>
<td>50</td>
</tr>
<tr>
<td><strong>ordering</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;">required</mark><br />string</td>
<td>The results are ordered by the filterName specified. This defaults to sort by ascending. Applying a ‘-’ before the filterName will produce a descending sort.</td>
<td>-contentClickThroughRate</td>
</tr>
<tr>
<td><strong>startDate:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;"><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark></mark><br />datetime</td>
<td>The date and time (UTC) of the earliest events in the report. Defaults to the last 31 days.</td>
<td>2022-02-06T07:00:00</td>
</tr>
<tr>
<td><strong>endDate:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>The date and time (UTC) of the latest events in the report. Default to the last 31 days. Max end date is 31 days after the start date.</td>
<td>2022-02-28T06:59:59</td>
</tr>
<tr>
<td><strong>offset:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #ff0000;"><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark></mark><br />number</td>
<td>This index begins at 0. It is used for how far down in the results for most popular searches, no result searches, and searches with no clicks tables to start collecting in the report. Defaults to 0.</td>
<td>0</td>
</tr>
<tr>
<td><strong>limit:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />number</td>
<td>This number begins at 0. It is used for how far down in the results for most popular searches, no result searches, and searches with no clicks tables to end the collection of data in the report. Defaults to the end of the results.</td>
<td>10</td>
</tr>
<tr>
<td><strong>language:</strong><br /><mark class="has-inline-color" style="background-color: rgba(0, 0, 0, 0); color: #32cd32;">optional</mark><br />string</td>
<td>A two-letter language code. Defaults to the <a href="/docs/searchstudio/searchstax-studio-multi-language-experiences/#default">default language</a>.</td>
<td>en</td>
</tr>
</tbody>
</table>
</figure>


<p>The returned value is a JSON document describing items. The parameters map into the values shown in the Site Search <a href="/docs/searchstudio/serchstax-studio-power-search/">Custom Reports</a> screen. A partial sample is shown below.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; auto-links: false; title: ; quick-code: false; notranslate">
{
  &quot;results&quot;: &#x5B;
    {
      &quot;clickCount&quot;: 1,
      &quot;ofTotal&quot;: 4.761904761904762,
      &quot;cDocId&quot;: &quot;0a13ade1-da89-4a78-9531-50efacfc48b4&quot;,
      &quot;cDocTitle&quot;: &quot;Sitecore 10.0 - SearchStax Docs&quot;,
      &quot;impressionCount&quot;: 7,
      &quot;contentClickThroughRate&quot;: 14.285714285714285,
      &quot;avgClickPosition&quot;: 5
    },
    {
      &quot;clickCount&quot;: 1,
      &quot;ofTotal&quot;: 4.761904761904762,
      &quot;cDocId&quot;: &quot;4e33c9c8-008a-43f9-bc08-85f8fc5e68c0&quot;,
      &quot;cDocTitle&quot;: &quot;Free Disk Space - SearchStax Docs&quot;,
      &quot;impressionCount&quot;: 7,
      &quot;contentClickThroughRate&quot;: 14.285714285714285,
      &quot;avgClickPosition&quot;: 1
    },
    {
      &quot;clickCount&quot;: 1,
      &quot;ofTotal&quot;: 4.761904761904762,
      &quot;cDocId&quot;: &quot;6289d367-00f2-4817-8659-00a5b0172ad3&quot;,
      &quot;cDocTitle&quot;: &quot;Sitecore Archives - SearchStax Docs&quot;,
      &quot;impressionCount&quot;: 18,
      &quot;contentClickThroughRate&quot;: 5.555555555555555,
      &quot;avgClickPosition&quot;: 1
    },

</pre></div>


<p></p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<h2 class="wp-block-heading" id="questions">Questions?</h2>



<p>Do not hesitate to contact the <a href="mailto:support@demo.searchstax.com?subject=Studio%3A%20Reporting%20API%20%28REST%29" target="_blank" rel="noreferrer noopener">SearchStax Support Desk</a>.</p>
</div></div>
<p>The post <a href="https://demo.searchstax.com/docs/searchstudio/searchstax-studio-reporting-api-rest/">Reporting API (REST)</a> appeared first on <a href="https://demo.searchstax.com/docs">SearchStax Docs</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
