I just installed RudderStack in a Nuxt 3 website f...
# support
h
I just installed RudderStack in a Nuxt 3 website following the official guide but I am not receiving any event. Can anyone help? Thanks
m
Hey There! 👋 Your message has been received by the RudderStack team. We will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
Hi Paola, can you confirm that the rudderstack js sdk loaded successfully. You should see a request like this `p=npm&v=2.33.1&writeKey=`⁣
We have seen that with NuxtJS since the window object is not present the SDK fails to load.
h
In Network, I can see that rudder-analytics.min.js loaded but p=cdn&v2.40.5&writeKey=… failed to load error message: write key not found in basic auth
m
Have you provided the correct write key? This is my writeKey `p=npm&v=2.33.1&writeKey=2Dmwv0Hkb18ldTh6cs4S8zuRKEg`⁣
You provide the writekey when you initialize the SDK. `rudderanalytics.load(WRITE_⁣KEY, DATA_⁣PLANE_⁣URL);`⁣
h
Yes, I doubled checked and the right key is in the script and is displayed in Network
m
You are using the write key ending in "qN2I4a"?
h
Yes
What is confusing to me is that I used the script provided in the how to integrate RudderStack with a Nuxt.js app doc page which is different from the one in my source setup page
m
Yes the source setup page is for JS, which is slightly different from the NuxtJS setup.
You should follow the NuxtJS doc
h
Ok so that is fine because that what I did. Any idea how to fix the error I am getting?
m
What is the dataplane url you are using? Can you share the website url?
h
Data plan is augeopartnswq.dataplane.rudderstack.com and for now I am testing in localhost:3000 as suggested by the doc. Http//192.168.4.863000
Screenshot 2023-08-31 at 1.23.37 PM.png
h
Yes
m
Can you share the xhr and pre-flight full network requests?
You can use right-click on the row in network tab and use copy as curl.
h
curl ‘https://api.rudderlabs.com/sourceConfig/?p=cdn&v=2.40.5&writeKey=2UkZmiFB0Tp9IbYyXr3gyqN2I4a’ \ -X ‘OPTIONS’ \ -H ‘authority: api.rudderlabs.com’ \ -H ‘accept: */*’ \ -H ‘accept-language: en-US,en;q=0.9,it;q=0.8,es;q=0.7’ \ -H ‘access-control-request-headers: authorization’ \ -H ‘access-control-request-method: GET’ \ -H ‘origin: http://localhost:3000’ \ -H ‘referer: http://localhost:3000/’ \ -H ‘sec-fetch-dest: empty’ \ -H ‘sec-fetch-mode: cors’ \ -H ‘sec-fetch-site: cross-site’ \ -H ‘user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36’ \ --compressed
I also got the following:
{“source”{“id”“2UkZmnZ2OUmbVgZhv10MVv6UWka”,“name”“augeopartners site staging”,“writeKey”“2UkZmiFB0Tp9IbYyXr3gyqN2I4a”,“config”{“statsCollection”{“errors”{“enabled”true},“metrics”{“enabled”false}}},“enabled”true,“workspaceId”“1xv2xBkT5D1B59EipFEXyJqsWQ1",“sourceDefinitionId”:“1TW48i2bIzEl1HPf825cEznfIM8",“destinations”[],“updatedAt”“2023-08-31T171930.636Z”,“createdAt”“2023 08 31T124139.140Z”,“liveEventsConfig”{“eventUpload”false,“eventUploadTS”1693502370635},“sourceDefinition”{“options”null,“config”null,“configSchema”null,“uiConfig”null,“id”“1TW48i2bIzEl1HPf825cEznfIM8”,“name”“Javascript”,“displayName”“Javascript”,“category”null,“type”“web”,“createdAt”“2019 11 12T123919.885Z”,“updatedAt”“2023-05-16T115225.474Z”},“createdBy”“1xv2pdPNbMKNF3KRX4JBsvsdfhL”,“secretVersion”null,“connections”[{“id”“2Ukcqn8tvmCNCLdgnX5CZI879Xu”,“sourceId”“2UkZmnZ2OUmbVgZhv10MVv6UWka”,“destinationId”“2UkcqlBszu6M8hapgVQuyb7lBMz”,“enabled”true,“deleted”false,“createdAt”“2023 08 31T130651.242Z”,“updatedAt”“2023-08-31T130651.242Z”}],“deleted”false,“transient”false}}
m
This is the expected result.
In the code snippet on this url the page call is commented out. Can you uncomment the page call. It is the line after the `console.log("We are all set");`⁣
h
Problem solved! Now I get the data when I reload the page! For getting page event on normal navigation I need to ad tracking under onMonunted() hook on each page?
Thank you.
m
Oh ok, this is like ReactJS right. I guess you should make a page call in the onMounted() hook.