Required API Key: any key with the search ACL

Method signature
$insights->user(string userToken)->clickedFilters(
  string eventName,
  string indexName,
  array filters
)

You’re currently reading the Ruby API client v2 documentation. Check the migration guide to learn how to upgrade from v1 to v2. You can still access the v1 documentation.

About this method

Send a click event to capture when users select filters.

Use this event to track when users click facet filters in your user interface.

Sending this event is useful for:

You can’t send these events for numeric filters.

Examples

Read the Algolia CLI documentation for more information.

For more information about initializing the Insights client aa, see Initialize the Insights client.

1
2
3
4
5
6
7
8
9
10
$insights = Algolia\AlgoliaSearch\InsightsClient::create(
  'YourApplicationID',
  'YourSearchOnlyAPIKey'
);

$insights->user("user-123456")->clickFilters(
  'Brand Clicked',
  'YourIndexName',
  ['brand:apple']
);

Parameters

userToken
type: string
pattern: [A-Za-z0-9_=+/-]{1,129}
Required

Anonymous user identifier.

See also: User Token

authenticatedUserToken
type: string
pattern: [A-Za-z0-9_=+/-]{1,129}
Optional

Pseudonymous identifier for authenticated users.

Never include personally identifiable information in user tokens.

See also: User Token

eventName
type: string
pattern: [\x20-\x7E]{1,64}
Required

Name of the specific event.

Format: 1-64 ASCII characters, except control characters.

To maximize the impact of your events, use consistent event names and consistent formatting—for example, “Product Added To Cart” (always in title case).

For example, you can adopt Segment’s object-action framework.

indexName
type: string
Required

Name of the Algolia index.

Format: same as the index name used by the search engine.

Some API clients use index instead of indexName.

filters
type: array
items: string
pattern: ${attr}:${value}
Required

List of facet filters.

You can include up to 10 filters.

Format: ${attribute}:${value}—for example, brand:apple. Both the attribute and value in each facet filter must be URL-encoded individually and separated by a :, such as, "discount:10%25".

Response

This method doesn't return a response.

Did you find this page helpful?