Product

5 reasons to add clicks to site search analytics (and code to do it)
facebooklinkedintwittermail

Capturing user behavior and intent with clicks (and conversion events) should not be an afterthought. Your online success depends on your ability to track and respond to users in a direct and immediate way. Such immediacy provides invaluable insights about their intent. Save for calling and asking them, your best bet is to integrate Click Analytics into your site search analytics. 

As you’ll see below, the insights obtained by site search analytics and click and conversion data form the basis for more advanced and competitive search functionalities, which work to let you utilize your search tools for fun and profit. 

Bonus: Implementation is surprisingly easy: in this article we include the single line of code needed.

Site search analytics, Click Analytics, and the Insights API: Why you should read this article

  • Learn the difference between site search analytics and Click Analytics
  • Understand the necessity of Click Analytics for dynamic relevance, A/B testing, recommendations, and Personalization
  • See how easy it is to implement Click Analytics using our Insights API

Comparing site search analytics with Click Analytics

Site search analytics offers insights on what your users search for and the most common terms they use. But search analytics for your site tells only part of the story; it misses a huge part of the user journey. 

Click Analytics picks up from there and tells you what your users do after they perform a search — whether they click or view items, and whether they convert.

What is Click Analytics?

Click Analytics collects detailed data about what your users view and click as they search, giving you an accurate picture of their product interests and behavior. In that regard, it is similar to Google Analytics, but its purposes also differ from those of GA.

Click Analytics is critical to improving your site search because it gives you insights about your catalog that you simply would not be able to get any other way. It generates conversion rates based on what your users purchase, add to their shopping carts, listen to, or view. Together with conversion analytics, it feeds into and makes possible ML/AI-driven functionalities such as Personalization, A/B testing, and Dynamic Re-Ranking, all enabling you to produce a competitive consumer-grade search experience on a par with those of giants like Amazon, Google, and Netflix. 

With the Insights API, you get all of that with only one line of code.

Top 5 reasons to add Click Analytics to your site search analytics

Before diving into the technical details, let’s look at what Click Analytics offers. You can:

1. View trends over time

Implementing Click Analytics allows you to keep track of metrics, including the click-through rate (CTR), conversion rate, and no-click rate, all of which reveal user intent.

  • A high click-through rate means a high percentage of searches in which an item has been clicked. It indicates customer engagement. 

 

  • A high conversion rate means a high percentage of searches in which an item has been converted. It shows that users can find what they’re looking for and that they want to convert. 

 

  • A high no-click rate means a high percentage of queries that generate no clicks. It indicates that items may no longer be trending or are getting less traction in the market.

These metrics benchmark your current performance and help you iterate and improve upon your search solution. With a continual flow of site search analytics, plus clicks and conversions, you’ll see how these metrics can grow over time when you make changes to your relevance settings. 

2. Incorporate the “wisdom of the crowd” (with a little AI help)

Dynamic Re-Ranking — a feature that adjusts the order of results based on recent clicks — is a striking example of how directly click analytics can impact your users’ Search and Discovery experiences. This feature responds to recent user behavior and pushes your best-performing items to the top of users’ results. 

For example, if an item trends unexpectedly, Dynamic Re-Ranking picks up on the trend and raises the item’s position to the top. New movies and music by popular artists get automatically sent to the top as soon as they are released. Seasonal and sudden fashion trends also get a boost.

3. Enable a personalized search experience

When you add user-specific information to your click and conversion events, you can leverage your analytics data to enable Personalization: a widely used feature that boosts products based on a user’s personal preferences for a specific facet or category of items. Personalization adds user-specific context to a query and makes conversion more likely.

4. Improve search results and locate problem queries

Click-through and conversion rates per query help you target queries that aren’t performing as well as they should. With an in-depth view of your click analytics that includes click position, you can understand exactly how your users are interacting with their search results. This data, easily viewable on Algolia’s dashboard, should help you analyze specific queries and optimize relevance or create Rules to improve their performance.

5. Test how users interact with optimizations

Along with measuring the success of particular queries, you can change settings within the engine and measure how that impacts overall success. Algolia handles all the variant switching of an A/B test. All you have to do is set up what you want to change and for how long. 

Consistently testing your relevance fine-tunes your solution’s settings and ensures an intuitive relevance and Personalization strategy.

Click Analytics and the Insights API: free to use, costly not to use

Site search analytics and Click Analytics are not a question of cost vs. benefits. Click Analytics is free. Our Insights API exposes a simple set of methods to capture your users’ clicks; there are negligible costs in terms of time and resources. And, as you’ll see, it’s pretty straightforward to implement. 

The key benefits, five of which are outlined above, are enormous, making Click Analytics a necessary part of every search solution. Getting direct and accurate feedback from your users about their behavior, interests, and expectations helps you measure the success of your search solution and improve customer retention.

How to Implement Click Analytics using the Insights API [Technical 🤓]

It’s always useful to know ahead of time the complexity — or in this case, the simplicity — of implementing a given component. 

So you’ll be glad to know that with Click Analytics, you need to take only one action: send user events to Algolia. 

You can send these events:

  • Clicks 
  • Conversions
  • Facet selections
  • Page or product views 

Once you start sending these events, Algolia does the rest. 

Click Analytics is about collecting key user events to build a database of user activity, and then analyzing and synthesizing that data to come up with accurate insights about user behavior, needs, and preferences. 

When you have substantial traffic, in just a short amount of time, your analytics data will produce the benefits discussed earlier. 

How do you send events? A quick overview of our Insights API

Very simply, Algolia needs the missing part of the user journey: what the user does when they get results from their search.

The first step is to tell Algolia that you’ll be sending events after users perform queries. As the screenshot below shows, Algolia returns a queryID with every set of results, which you can use to associate the query with subsequent click events. This diagram outlines what happens when a user performs a query, views the results, clicks items, and places an item in the basket.

To easily send this information to Algolia, you have a number of options (API client or front-end libraries). The most important part is deciding which one is best for your technical stack.

Which library or API do you use to send events?

Algolia has made sending events as easy as possible, and the route you choose will depend on your technical stack and exactly what you want to do.

You can decide based on whether you are using InstantSearch and whether you want to send events from the front end or the back end:  

  1. You’re using InstantSearch on your front end
    • New! Use the Insights middleware for events (requires InstantSearch.js v4.8.3) on the search results page
    • Use the Insights client library for events and any other page that requires events, such as a checkout or wishlist pag,
    • Note: We have versions of InstantSearch for vanilla JavaScript, React, Angular, Vue, iOS, and Android.
  2. You’re not using InstantSearch on your front end, but you want to send events from the front end.
  3. You’re not using InstantSearch, you have a back-end implementation, and you want to send events from the front end
  4. You’re not using InstantSearch, you have a back-end implementation, and you want to send events from the back end

We recommend that you use Algolia’s InstantSearch library, letting InstantSearch manage the call to our Insights API. That said, the Insights API is built to be simple, requiring only a single call to create the click event.

Ok, let’s see the code (one-minute read)

So what does our Insights library look like? And how does it make implementation easier?

The standard code snippet below illustrates the code you need. It sends the following information to Algolia’s Analytics engine:

  • User’s token
  • Query ID
  • Object ID for the item clicked
  • The item’s position in the results
  • Type of event (click, conversion, view)

This is the code to send a click event:

insights_library('clickedObjectIDsAfterSearch', {
    userToken: 'user-123456',
    eventName: 'Product Clicked',
    index: 'products',
    queryID: 'cba8245617aeace44',
    objectIDs: ['9780545139700'],
    positions: [7],
});

That’s it. 

For the full code, which you can copy into your apps, check out our send click event documentation

For those of you who love to see live coding, watch how we build an app in 5 minutes that sends Analytics events.

What does this code do?

The general idea behind the code is to send a specific kind of event. Here, the event is a user’s click on a search result. 

There are other kinds of events as well. For example, let’s add a “conversion” event to the above “click” event:

insights_library('convertedObjectIDsAfterSearch', {
    userToken: 'user-123456',
    index: 'products',
    eventName: 'Product Wishlisted',
    queryID: 'cba8245617aeace44',
    objectIDs: ['9780545139700', '9780439785969']
});

This sends a wishlist conversion event. The function’s parameters indicate that the user added two objects to their wishlist (9780545139700 and 9780439785969). 

To get the full code, which you can copy into your app, check out our send conversion event documentation.

What do these events tell us about the user’s journey and buying preferences?

To begin with, the user searched for “harry potter”. Then did the following:

  • Clicked a result (let’s say “Harry Potter, Book 1,” indicated by its objectID)
  • Converted “Harry Potter, Book 1” by adding it to their wishlist 
  • Converted another book (“Harry Potter, Book 2”)

What can you learn from this journey? 

  • This user shows an affinity for children’s items and maybe also adventure or fantasy books. You can use this information to personalize their results.
  • If many users do this same thing, then Harry Potter books should appear higher in the results. If this is a trend, and you’ve enabled dynamic-ranking, then the search engine will do this automatically. Otherwise, you can improve the position value that you had sent with your click event (and which is saved in the analytics database). In this example, you sent positions: [7], which may be too low. You can improve the position by refining and restructuring your data and/or adjusting your settings.

Further reading

Our docs do a great job of explaining each parameter for sending events. They also show the  code snippet in 11 other languages (PHP, JavaScript, Ruby, Python, C#/.NET, Java, Swift, Android, Kotlin, Golang, and Scala). 

We also have many helpful tutorials; for instance, check out our Click Analytics solution.

What’s next 

You now know five key reasons to implement Click Analytics. To recap, it lets you:

  • Detect patterns of click and conversion behavior, which you can then use to configure your settings and reorder results
  • Detect recent buying trends, which the search engine can use to push the best-performing items to the top of search results — dynamically and immediately
  • Capture every user’s unique search and click activity to personalize their results for a particular set of facets or category of items
  • Detect and help resolve inefficient search experiences
  • Test search settings using A/B testing 

It’s still a bit of a novelty that a search bar could provide so many insights. Or is it? Google Analytics has been around for quit some time, helping online businesses iterate on the best formula for their success.. We’ve described how you could use Click Analytics to achieve similar insights, 

Our recommendation: get your business and dev teams to work together to implement the Click Analytics Insights API.

About the authorsAlexis Monks

Alexis Monks

Solutions Architect
Peter Villani

Peter Villani

Sr. Tech & Business Writer

Recommended Articles

Powered by Algolia AI Recommendations

Search Analytics: Gain Insights from User Search Data
Product

Search Analytics: Gain Insights from User Search Data

Nicolas Baissas

Nicolas Baissas

How and why events drive search ROI
Product

How and why events drive search ROI

Jaden Baptista

Jaden Baptista

Technical Writer
Ben Franz

Ben Franz

Sales Engineering and Product Leader at Algolia
Why you should capture click and conversion events from day one
Engineering

Why you should capture click and conversion events from day one

Jaden Baptista

Jaden Baptista

Technical Writer