Findify Agent
Intro
Findify Agent was made to simplify data fetching process and to be framework and platform agnostic.
The Agent could be easily injected in jQuery, Angular or even React-Native project with minimal overhead.
Integrate
Obtaining Findify API Key
Before you start, you need to get the Findify API Key in order to get access to the API. You need to follow the onboarding process or get the API key from your Merchant Dashboard
Script tag
In order to use Findify Agent directly in the browser, you need to include the following scripts on your page:
<script src="https://cdn.jsdelivr.net/npm/@findify/[email protected]/dist/findify-analytics.js"></script>
<!-- Findify Agent -->
<script src="https://cdn.jsdelivr.net/npm/@findify/[email protected]/dist/findify-agent.js"></script>
Findify Agent and Findify Analytics will be available in the window
object as window.FindifyAnalytics
and window.FindifyAgent
NPM
If you are using NPM, just install the libraries from our public NPM registry
npm i --save @findify/agent @findify/analytics
Minimal Setup
The minimal setup requires you to just create the instance of Findify Analytics and Findify Agent, the rest will be handled automatically.
var API_KEY ='YOUR_API_KEY';
var Autocomplete = window.FindifyAgent.Autocomplete;
var Analytics = window.FindifyAnalytics;
// Initialize libraries
var analyticsInstance = Analytics({ key: API_KEY });
var autocompleteInstance = new Search({
key: API_KEY,
user: analytics.user
});
// Subscribe to changes in suggestions
autocompleteInstance.on('change:suggestions', function(suggestions) {
// render suggestion
});
// Send request with some query
autocompleteInstance.set('q', 'white');
const Autocomplete = require('@findify/Agent').Autocomplete;
const Analytics = require('@findify/Analytics');
// Initialize libraries
const analyticsInstance = new Analytics({ key: API_KEY });
const autocompleteInstance = new Search({
key: API_KEY,
user: analytics.user
});
// Subscribe to changes in suggestions
autocompleteInstance.on('change:suggestions', function(suggestions) {
// render suggestion
});
// Send request with some query
autocompleteInstance.set('q', 'white');
Live example
Updated almost 5 years ago