0.25.0 • Published 1 month ago

@botonic/plugin-hubtype-analytics v0.25.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 month ago

Botonic Plugin Hubtype Analytics

What Does This Plugin Do?

This plugin is used to integrate Hubtype Analytics Service in your Botonic project.

Setup

  1. Install the plugin from npm (or yarn):
npm i @botonic/plugin-hubtype-analytics
  1. Add it to the src/plugins.js file defining the projectId of the Project you want to use:

You can define two optional functions to obtain the language and the country. By default if you do not define these functions it will use the language defined in request.session.user.extra_data.language and country defined in request.session.user.extra_data.country

  export const plugins = [
    {
      id: 'hubtype-analytics',
      resolve: require('@botonic/plugin-hubtype-analytics'),
      options: {
        getLaguange?: (request: BotRequest) => request.session.user.extra_data.lang
        getCountry?: (request: BotRequest) => request.session.user.extra_data.store
      },
    },
  ]

Use

You can use it in your actions for example an event to check that a faq has been displayed in the bot:

  const hubtypeAnalyticsPlugin = request.plugins.hubtypeAnalytics
  const eventBotFaq = {
    event_type: EventName.botFaq
    event_data: { enduser_language: 'en', faq_name: 'orders_and_deliveries' }
  }
  try {
    const response = await hubtypeAnalyticsPlugin.trackEvent(request, event)
    console.log(response)
  } catch(error) {
    console.log(error)
  }

Plugin Options

  • getLaguange: getLaguange(request) function to define the language when it is not in request.session.user.extra_data.language
  • getCountry: getCountry(request) function to define the country when it is not in request.session.user.extra_data.country
0.25.0

1 month ago

0.25.0-beta.0

1 month ago

0.25.0-alpha.2

2 months ago

0.25.0-alpha.1

2 months ago

0.25.0-alpha.0

3 months ago

0.24.0

4 months ago

0.23.2

5 months ago

0.23.1

7 months ago

0.23.1-alpha.1

7 months ago

0.23.1-alpha.0

7 months ago

0.23.0

8 months ago

0.22.0-alpha.7

9 months ago

0.22.0-alpha.6

9 months ago

0.22.0-alpha.5

10 months ago

0.22.0-alpha.4

10 months ago

0.22.0-alpha.3

10 months ago

0.22.0-alpha.2

10 months ago

0.22.0-alpha.1

10 months ago

0.22.0-alpha.0

10 months ago