Findify Analytics Reference

Intro

The Findify Analytics is a library that sets up environment variables and expose methods you can use to track and store events required by the Feedback API and our ML algorithms. It will automatically define the best data transfer method depending on the browser version or environment.

Configuration

key

Your private API key, which you can get in the "integration section" of Merchant Dashboard

events

Key-value object with events that you don't want to track. You can set an to false to disable automatic tracking for it. By default Findify Analytics tracks everything.

events: { 'view-page': false }

platform

Enable specific platform based logic, currently extra logic is implemented just for bigcommerce and shopify platforms.

platofrm: { bigcommerce: true }

Methods

sendEvent

Sends an event to the Feedback API with parameters defined in the second parameter. The third argument determines if this event should be saved in cookies or not, to prevent losing this event when the page reloads.

analytics.sendEvent('click-item', { rid: REQUEST_ID, id: ITEM_ID }, true)

listen

Allows to listen to all events that are tracked through analytics

var unsubsribe = analytics.listen(function (event, props) { }); // Start listening to events
unsubsribe() // Remove event listener

invalidate

Updates analytic.store and sends provided events to the Feedback API immidiately

analytics.invalidate({ 'click-suggestion': {...} })

Properties

user

Getter function, that returns the current user. This user object is required in Agents and SDK.

console.log(analytics.user)
// > { uid: USER_ID, sid: SESSION_ID, persist: true/false }

state

Getter/Setter functions, that returns information about previously tracked events that are not sent to the Feedback API yet

console.log(analytics.state)
// > { 'view-page': {...}  }

analytics.state = { 'add-top-cart': {...} }
console.log(analytics.state)
// > { 'view-page': {...}, 'add-top-cart': {...}  }