Trending queries

The Trending queries API provides list of popular and relevant phrases based on the analytics events. These phrases are customizable from the Luigi's Box application dashboards.

Trending queries endpoint is particularly suited for building a "trending queries" widget on your site.

Calling this endpoint gives you a list of your top queries for the past 30 days but you can customize this list in the main Luigi's Box application. There are no API parameters, the output is only controlled from Luigi's Box application UI.

In the application, look for the menu "Trending queries API settings". If you don't see it, contact us to enable it.

From the management UI, you can:

  • Set the number of returned queries
  • Ban some queries from appearing in the API output
  • Rewrite query text, e.g., to add accents or change caps
  • Add your own queries, even if they are not trending at the moment
  • Enable top hit loading for a query, you can use the top hit URL in the widget to send users directly to the most popular result for the query

Get trending queries


tracker_id Identifier of your site within Luigi's Box. You can see this identifier in every URL in the Luigi's Box app once you are logged-in.

Consider sending request header of Accept-Encoding as well with values for supported encoding methods of your HTTP client, e.g. gzip or br, gzip, deflate for multiple supported methods. Encodings make the response from Trending queries endpoint considerably smaller and thus faster to transfer.

require 'faraday'
require 'faraday_middleware'
require 'json'

connection = '') do |conn|
  conn.use FaradayMiddleware::Gzip

response = connection.get("/v2/trending_queries?tracker_id=1234-5678")

if response.success?
  puts JSON.pretty_generate(JSON.parse(response.body))
  puts "Error, HTTP status #{response.status}"
  puts response.body


curl -i -XGET --compressed\


// Using Guzzle (
require 'GuzzleHttp/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('GET', "", [
  'headers' => [
    'Accept-Encoding' => 'gzip'

echo $res->getStatusCode();
echo $res->getBody();

// This endpoint requires no authentication

// This endpoint requires no body

The above command returns JSON structured like this.

    "title": "Query A",
    "links": [{
      "rel": "top_content",
      "href": ""
    "title": "query B"