Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import algoliasearch from 'algoliasearch/lite';
- import { history as historyRouter } from 'instantsearch.js/es/lib/routers';
- import { singleIndex as singleIndexMapping } from 'instantsearch.js/es/lib/stateMappings';
- // Send algolia insights events
- // www.algolia.com/doc/guides/building-search-ui/going-further/send-insights-events/js/
- // www.algolia.com/doc/api-reference/widgets/insights/vue/
- import aa from 'search-insights';
- import { createInsightsMiddleware} from 'instantsearch.js/es/middlewares';
- const insightsMiddleware = createInsightsMiddleware({
- insightsClient: aa,
- insightsInitParams: {
- useCookie: false,
- },
- });
- export default {
- props: ['tips', 'algoliaIndex', 'algoliaSearchApiKey'],
- data() {
- return {
- searchClient: algoliasearch(
- 'xxxxxxxxxxxx',
- this.algoliaSearchApiKey
- ),
- routing: {
- router: historyRouter(),
- stateMapping: singleIndexMapping(this.algoliaIndex),
- },
- middlewares: [insightsMiddleware]
- };
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement