add documentation on how to use insights middleware in Nuxt
See original GitHub issueBug 🐞
What is the current behavior?
Currenly i’m using ais-instantsearch-ssr and i want to add algolia analytics to this. But right now i get some errors regarding the server side rendering and etc.
What is the expected behavior?
Track searchs, clicks, and conversions with insights.
RIght now i get a window is not defined when i add insights to data like this:
data() {
// Created in `data` to access the Vue Router
const mixin = createServerRootMixin({
searchClient: getSearchClient(),
indexName: process.env.indice,
clickAnalytics: true,
replicas: [
`SortByDESC ${process.env.commerceCulture}`,
`SortByASC ${process.env.commerceCulture}`,
`SortByLaunch ${process.env.commerceCulture}`,
`SortByDiscountDESC ${process.env.commerceCulture}`
],
routing: {
router: nuxtRouter(this.$router),
stateMapping: singleIndex(process.env.indice),
},
});
return {
...mixin.data(),
insightsClient: window.aa,
};
},
is there a fix to this? if i add it in beforeMount i get this error on clicks:
Do you have a working example with insights enabled in nuxt?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Middleware directory - Nuxt
The middleware directory contains your application middleware. ... define page-specific middleware by using a function directly, see anonymous middleware .
Read more >Creating Server-side Rendered Vue.js Apps Using Nuxt.js
Nuxt provides a way to customize the router instance in the config, allowing you to add new routes and customize generated routes. You...
Read more >Universal application code structure in Nuxt.js - freeCodeCamp
Since Nuxt uses connect to deliver the application, it allows custom functions to be hooked into the underlying request pipeline as middleware.
Read more >Add 2FA to Your Nuxt Application with Nexmo Verify
Nuxt is a framework for building 'Universal Vue.js Applications'. Essentially, this means that when you use Nuxt you have the option of building ......
Read more >Monitor your Node.js services and apps with Application Insights
You can use Application Insights for Node.js services that are hosted in ... Add the Node.js client library to your app's dependencies via ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it would be
this.insightsClient
, but yesHey! I guess Nuxt doesn’t have access to the
window
object when rendering on the server. Can you try to installsearch-insights
in your project, and to import Search Insights in your file?