Search

This event marks a visitors search action for items on a search result page

💡

Using the Tweakwise JS implementation?

When using the Tweakwise JS implementation, this event is automatically submitted when the base script is included. You won't need any additional implementation for this event.

To the API-reference

How to implement?

<!-- This event is already included in the base tag, only implement this manually for custom scenarios-->
<!-- INSTANCE_KEY SESSION_KEY AND PROFILE_KEY are inherited from the base tag -->
<script>
  tweakwiseLayer.push({
  event: 'search',
	data: {
		searchTerm: 'SEARCH_TERM'
  }
});
</script>
curl --request POST \
     --url 'https://navigator-analytics.tweakwise.com/api/search?instanceKey=INSTANCE_KEY' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "ProfileKey": "PROFILE_KEY",
  "SearchTerm": "SEARCH_TERM",
  "SessionKey": "SESSION_KEY"
}
'

Parameters

NameTypeRequiredDescription
INSTANCE_KEYURL-parameter - textyesYour Tweakwise Instance Key
SEARCH_TERMBody parameter - textyesThe term being searched for
SESSION_KEYBody parameter - textyesThe session key for the specific user. This can be your own session key or GA session. As long as it's consistent throughout the user's session.
Allowed characters: alphanumeric and hyphens
PROFILE_KEYBody parameter - textyesThe ID that identifies the current visitor. Read more about the profile key here

When do I submit this event?

Submit this event for every display of a search results page.

⚠️

Do not submit for suggestions

Do not submit this event when showing suggestions. Suggestions are updated on every keystroke, resulting in submitting events for unfinished words or sentences. This will result in an incorrect view of the search behavior of a visitor.

Where do I implement this event in the code?

On the search results page.

How to handle event-specific warnings from Tweakwise

⚠️No Searches received in the last 4 days

Description

No Searches events have been received in the last 4 days.

Possible solution

Check if the search functionality on the platform is working properly and ensure that the Tweakwise tracking/event tag for search queries is being triggered correctly on every search action on the search results page.

⚠️SessionKey: xx% missing / ProfileKey: xx% missing/SearchTerm: xx% missing

Description

More than 0.5% of the Searches events are missing one of the required fields (SessionKey, ProfileKey, or SearchTerm).

Possible solution

Ensure that the respective field is always populated in the payload/event data before sending the event to Tweakwise.

⚠️Mismatched sessionkeys in this event and SessionStart (xx%)

Description

More than 5% of the Searches events contain a SessionKey that does not match a known SessionStart event.

Possible solution

Check the creation and lifespan of session cookies/keys on the platform. Make sure that when a session starts, the SessionStart event is triggered before or together with other events.

Please share your findings with your implementation partner. If they have questions about these messages, please have them contact [email protected]