Analytics is built to track the user behavior on your website or mobile app, or in nodejs, which is required by our machine learning and personalization algorithms.
Integrateš§
Obtaining API Key
Before you start, you need to get the 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 Analytics directly in the browser, you need to include the following script on the page:
HTML
<!-- Findify Analytics --><script src="https://cdn.jsdelivr.net/npm/@findify /analytics@latest /dist/findify-analytics.js"></script>
Analytics will be available in theĀ window
Ā object asĀ window.FindifyAnalytics
.
NPM
If you are using NPM, just install the library from our public NPM registry.
Shell
npm i --save @findify /analytics
SetupTo start tracking events on the page, you need to initialize the analytics object. There can be only one instance ofĀ Analytics
, so every next initialization will override the previous one.
JavaScript
var API_KEY ='YOUR_API_KEY';var Analytics = window.FindifyAnalytics;// Initialize Analyticsvar analyticsInstance = Analytics({ key: API_KEY });// Start sending eventsanalyticsInstance.sendEvent('click-item', { rid: REQUEST_ID, id: ITEM_ID });