Initializes library.

Arguments:

config.key required (string): Merchant API key.

Returns:

Client instance, which could be used further for sending feedback requests to the server.

// First, you need to initialize library:
var client = findifyAnalytics({
    key: 'b9h348b89h439g43'
});

// Then, you should initialize client instance.
// Usually you want to do this on document ready event to collect all data from HTML tags.
client.initialize();

// After library initialized, we can send event requests to server with `client` instance. Let's perform click-suggestion request:
client.sendEvent('click-suggestion', {
  rid: 'request_id',
  suggestion: 'Black t-shirt'
});

// You can get `user` instance, which can be used further in `findify-sdk` library:
var user = client.user;

// To access events on the page you can use `client.state`,
// Analytics state represents all events that was defined on the page
// before findify

// You can listen for events with `listen` function
var unsubscribe = client.listen(function(event, payload) {
  console.log(event); // outputs event name
  console.log(payload); // outputs event payload
});