Algolia Insights is a Flutter library for tracking and analyzing user behavior on search and discovery experiences powered by Algolia. The purpose of Algolia Insights is to provide a simple and flexible way to track events such as clicks, conversions, and views on search results. This data can then be used to personalize the search experience for each user by providing insights into what users are searching for and how they are interacting with the search results. Additionally, Algolia Insights provides a way to track user behavior across multiple devices and sessions, allowing you to get a complete picture of how users interact with your search and discovery experiences over time.
Add the Algolia Insights package to your pubspec.yaml file:
dependencies:
algolia_insights: ^0.2.0
To start using Algolia Insights, you will first need to initialize an instance of the Insights class and pass in your Algolia application ID and API key.
import 'package:algolia_insights/algolia_insights.dart';
Insights insights = Insights(
applicationID: 'YourApplicationID',
apiKey: 'YourAPIKey',
);
To send events to Algolia Insights, use the methods available on the Insights instance. For example, to send a click event:
insights.clickedObjects
(
indexName: 'YourIndexName',
objectIDs: ['object-123'],
eventName: 'click',
);
The following event types are supported by Algolia Insights:
click
: Track when a user clicks on a search resultconversion
: Track when a user converts on a search resultview
: Track when a user views a search result
You can set a custom user token by setting the userToken property on the Insights instance. The user token is used to track events for a specific user.
insights.userToken = 'user-123';
For more information on how to use Algolia Insights with Flutter, see the official documentation.
Contributions are welcome! If you find a bug or want to request a new feature, please open an issue. If you want to contribute, please open a pull request.