@nacelle/client-js-sdk
TypeScript icon, indicating that this package has built-in type declarations

3.7.2 • Public • Published

Nacelle Client SDK

How to use

npm install @nacelle/client-js-sdk

Instantiate Client

import NacelleClient from '@nacelle/client-js-sdk'

const settings = {
  id: '<YOUR_NACELLE_SPACE_ID>',
  token: '<YOUR_NACELLE_SPACE_TOKEN>',
  locale: 'en-us',
  nacelleEndpoint: 'https://hailfrequency.com/v2/graphql',
}

const client = new NacelleClient(settings)

With the client initialized you now have access to four modules, data, checkout, events, and status that will allow your app to interact with Nacelle and your data.

Register Attribution Event

Any event type can be registered as an attribution event. The first parameter is the event type and the second is the event data to attribute to future events.

client.events.onAttributionEvent('productRecommendation', (event) => ({
  sourceHandles: event.sourceHandles,
  recommendedHandles: event.recommendedHandles,
  clickedHandle: event.clickedHandle,
}))
client.events.onAttributionEvent('search', (event) => ({
  query: event.query,
  resultCount: event.resultCount,
}))

The most recent attribution event data will then be attached to subsequent events that occur. For example search data may be attributed to a productView event.

Readme

Keywords

none

Package Sidebar

Install

npm i @nacelle/client-js-sdk

Weekly Downloads

2,703

Version

3.7.2

License

MIT

Unpacked Size

962 kB

Total Files

63

Last publish

Collaborators

  • dave.king.nacelle
  • nacelle-support
  • jeffrichie
  • darrik-moberg
  • stuckya
  • badiolaignacio
  • dzouras
  • andrew-nacelle
  • nwrichmond
  • brianvanderson
  • cbodtorf
  • krisq
  • curbol
  • irnoble
  • jongeyer
  • nacelle-bot