Users have different levels of intent when they visit your website. Your high-intent customers might know what they want and buy it right away, while the low-intent visitors may browse around, unsure of their next step. Both types of users may use the search option of your website, and it’s probably a good idea to track these results.

This is where Oribi comes into the picture, giving you concise metrics on what users are actually searching for and how it connects to your conversions. Our goal here is to set up the search results as Oribi's Magic Custom Events, so you can explore them and use them in funnels and correlations.

It gets a little technical from this point on, but don't be alarmed. 🤓 You can either send this to your developer or try it yourself (there may be a bit of trial and error).

Quick Overview - What You’ll Need to Do

  1. Find out where you can implement JavaScript on your website. If you have Google Tag Manager, that's the easiest method. If not, feel free to ask our team or browse your platform's guidelines.

  2. Locate the search results variable. Use your website’s search feature; enter any keyword in the search field and hit the “Search” button.

    Did the URL change? If yes, check if the search term is displayed after the question mark (?) . Most commonly, it would look like this: mywebsite.com/?q="searchterm".

    "searchterm" is the golden variable that should be sent to Oribi.

  3. Next, you will extract the search term from the URL, depending on the URL structure.

  4. Then, you will send it to Oribi as a custom event.

If You Have Google Tag Manager

Follow these steps to configure the setup within Google Tag Manager.

If the search term comes after a '?'

  1. Create a new built-in variable:

    1. In the left navigation, click Variables.

    2. In the User-Defined Variables section, click New.

    3. Click Variable Configuration and select URL.

    4. Component Type should be Query.

  2. The query key would be the term that comes before the search term.
    If my URL is mywebsite.com/catalogue/?search="searchterm", the query key is search.

  3. Name the variable as "searchterm" and click Save.

  4. Create a new trigger:

    1. In the left navigation, click Triggers and then click New.

    2. Click Variable Configuration and select URL.

    3. Click Trigger Configurtion and select Page View.

    4. Click "Some Page Views" and choose from the left dropdown list.

    5. Choose "Contains" From the middle dropdown list.

    6. The value in the last text box should be part of the URL that appears only during search, but doesn't come after a '?'.
      If my URL is mywebsite.com/catalogue/?search="searchterm", the value key is catalogue.

    7. Save the trigger.

  5. Set up the tag:

    1. In the left navigation, click Variables and then click New.

    2. Click Tag type and select Custom HTML.

    3. The tag content should be:

      <script> ORIBI.api("track", {{searchterm}});</script>
    4. Choose the newly created trigger as the trigger for this tag.

    5. Save the tag.

Publish the changes and test your newly created tag! The search term should appear under "Explore Custom Events" in Oribi.

If your search term comes after '#'

Follow the steps above with one change -

in (1.D), Component Type should be "Fragment" and not "Query".

If You DO NOT Have Google Tag Manager

If the search term comes after a '?'

  1. Count how many characters stand between the last '/' and your search term.
    In the example above, it's three - ?q=.
    In that example, there are seven - mywebsite.com/?query="searchterm".

  2. Insert the following JavaScript code in the appropriate place on your platform.
    Note 1: You might or might not need the leading and closing <script>.
    Note 2: The number in the parentheses should be the number of characters you counted in point 3.

    <script> var query = window.location.search.substring(3);
  3. You can insert the code above on any page or just in pages whose URL indicates that a user did a search.
    For example, this can be a trigger for Google Tag Manager:

  4. Perform a search and check that the search term appears on Oribi's Explore Custom Events dropdown list.

Now, you’re ready to track and analyze any search query as a Custom Event on Oribi. Also, you can see what your visitors search for and how you can make more frequently searched information more accessible to them on your site! Adding these to your funnels can make a significant impact in defining what search results drive conversions.

Did this answer your question?