2

I am trying to add Segment-Analytics to a VueJS app but currently, no data is being sent. I think the issue is where I am including Segment's snippet. I have so far pasted into the tag of public.html, but I have seen other methods. I am trying to figure out the best way to do this.

here are my package.json dependencies including vue-segment-analytics:

 "dependencies": {
    "axios": "^0.19.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "bootstrap-vue": "^2.0.0-rc.28",
    "connect-history-api-fallback": "^1.6.0",
    "core-js": "^2.6.5",
    "epic-spinners": "^1.1.0",
    "force-secure-express": "^1.0.1",
    "jquery": "^1.9.1",
    "lodash-for-vue": "^1.0.3",
    "moment-strftime": "^0.5.0",
    "register-service-worker": "^1.6.2",
    "vee-validate": "^2.0.0-rc.27",
    "vue": "^2.6.10",
    "vue-axios": "^2.1.4",
    "vue-router": "^3.0.3",
    "vue-segment-analytics": "^0.3.2",
    "vue-snotify": "^3.2.1",
    "vue-sweet-calendar": "^0.3.1",
    "vuex": "^3.0.1"

I have added the Segment code snippet in the tag in public/index.html.

and in my components, I have, eg:

mounted() {
    this.getPosts();
    window.analytics.page('Home') // from segment.io docs
  },

Segment is telling me that no data is being sent.

user2799827
  • 1,077
  • 3
  • 18
  • 54

1 Answers1

0

Here's a medium post I wrote out of frustration on how to setup Vue 3 + Segment + Amplitude

luigi7up
  • 5,779
  • 2
  • 48
  • 58