{"action":"created","issue":{"url":"https://api.github.com/repos/MatteoGabriele/vue-analytics/issues/142","repository_url":"https://api.github.com/repos/MatteoGabriele/vue-analytics","labels_url":"https://api.github.com/repos/MatteoGabriele/vue-analytics/issues/142/labels{/name}","comments_url":"https://api.github.com/repos/MatteoGabriele/vue-analytics/issues/142/comments","events_url":"https://api.github.com/repos/MatteoGabriele/vue-analytics/issues/142/events","html_url":"https://github.com/MatteoGabriele/vue-analytics/issues/142","id":346193556,"node_id":"MDU6SXNzdWUzNDYxOTM1NTY=","number":142,"title":"An event triggered before the GA library is loaded is ignored","user":{"login":"i4ntch1k","id":13999879,"node_id":"MDQ6VXNlcjEzOTk5ODc5","avatar_url":"https://avatars2.githubusercontent.com/u/13999879?v=4","gravatar_id":"","url":"https://api.github.com/users/i4ntch1k","html_url":"https://github.com/i4ntch1k","followers_url":"https://api.github.com/users/i4ntch1k/followers","following_url":"https://api.github.com/users/i4ntch1k/following{/other_user}","gists_url":"https://api.github.com/users/i4ntch1k/gists{/gist_id}","starred_url":"https://api.github.com/users/i4ntch1k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/i4ntch1k/subscriptions","organizations_url":"https://api.github.com/users/i4ntch1k/orgs","repos_url":"https://api.github.com/users/i4ntch1k/repos","events_url":"https://api.github.com/users/i4ntch1k/events{/privacy}","received_events_url":"https://api.github.com/users/i4ntch1k/received_events","type":"User","site_admin":false},"labels":[{"id":586428848,"node_id":"MDU6TGFiZWw1ODY0Mjg4NDg=","url":"https://api.github.com/repos/MatteoGabriele/vue-analytics/labels/P3:%20Important","name":"P3: Important","color":"f9d0c4","default":false},{"id":474069295,"node_id":"MDU6TGFiZWw0NzQwNjkyOTU=","url":"https://api.github.com/repos/MatteoGabriele/vue-analytics/labels/bug","name":"bug","color":"ee0701","default":true},{"id":553197628,"node_id":"MDU6TGFiZWw1NTMxOTc2Mjg=","url":"https://api.github.com/repos/MatteoGabriele/vue-analytics/labels/high%20priority","name":"high priority","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-31T13:42:46Z","updated_at":"2018-08-24T11:27:48Z","closed_at":null,"author_association":"NONE","body":"If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.\r\n\r\n### Description\r\n\r\nAn event triggered by a \"mounted\" hook in a component is ignored since GA is not fully loaded yet.\r\n\r\n### Expected behavior\r\n\r\nThe event should be delayed until the library is fully loaded and then triggered.\r\n\r\n### Actual behavior\r\n\r\nThe event is triggered and fails since no tracker has been created yet.\r\nHere is what displays Google Analytics Debugger addon on Chrome: \r\nInitializing Google Analytics.\r\nanalytics_debug.js:10 Running command: ga(\"send\", \"event\", {eventCategory: \"myCategory\", eventAction: \"myAction\", eventLabel: \"myLabel\"})\r\nanalytics_debug.js:10 Command ignored. Unknown target: undefined\r\nanalytics_debug.js:10 Running command: ga(\"create\", \"UA-…\", \"auto\", {})\r\nanalytics_debug.js:10 Creating new tracker: t0\r\nanalytics_debug.js:10 Auto cookieDomain found: \"none\"\r\nanalytics_debug.js:10 Registered new plugin: ga(provide, \"render\", Function)\r\n(the \"pageview\" command successfully appears in GA dashboard, but not the \"event\")\r\n\r\nSubsequent events are well triggered and appear in GA dashboard.\r\n\r\n### Environment\r\n\r\nvue-analytics@5.12.2\r\n\r\nThen, specify:\r\n\r\n1. Operating system: MacOS 10.13.6\r\n2. Browser and version: Chrome, Version 67.0.3396.99 (Official Build) (64-bit)\r\n\r\n### Reproducible Demo\r\n\r\nIn main.js:\r\n```\r\nimport Vue from 'vue'\r\nimport VueAnalytics from 'vue-analytics'\r\nimport App from '@/App.vue'\r\n\r\nVue.use(VueAnalytics, {\r\n  id: process.env.GOOGLE_ANALYTICS_KEY\r\n})\r\n\r\nnew Vue({\r\n  render: h => h(App)\r\n}).$mount('#app')\r\n```\r\n\r\n\r\nIn App.vue:\r\n\r\n```\r\n<template>\r\n  <span>test</span>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n  mounted () {\r\n    this.$ga.event({\r\n      eventCategory: 'myCategory',\r\n      eventAction: 'myAction',\r\n      eventLabel: 'myLabel'\r\n    })\r\n  }\r\n}\r\n</script>\r\n```"},"comment":{"url":"https://api.github.com/repos/MatteoGabriele/vue-analytics/issues/comments/415731745","html_url":"https://github.com/MatteoGabriele/vue-analytics/issues/142#issuecomment-415731745","issue_url":"https://api.github.com/repos/MatteoGabriele/vue-analytics/issues/142","id":415731745,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTczMTc0NQ==","user":{"login":"ajshortt","id":6783995,"node_id":"MDQ6VXNlcjY3ODM5OTU=","avatar_url":"https://avatars1.githubusercontent.com/u/6783995?v=4","gravatar_id":"","url":"https://api.github.com/users/ajshortt","html_url":"https://github.com/ajshortt","followers_url":"https://api.github.com/users/ajshortt/followers","following_url":"https://api.github.com/users/ajshortt/following{/other_user}","gists_url":"https://api.github.com/users/ajshortt/gists{/gist_id}","starred_url":"https://api.github.com/users/ajshortt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajshortt/subscriptions","organizations_url":"https://api.github.com/users/ajshortt/orgs","repos_url":"https://api.github.com/users/ajshortt/repos","events_url":"https://api.github.com/users/ajshortt/events{/privacy}","received_events_url":"https://api.github.com/users/ajshortt/received_events","type":"User","site_admin":false},"created_at":"2018-08-24T11:27:48Z","updated_at":"2018-08-24T11:27:48Z","author_association":"NONE","body":"Any movement on this? Having the same issue. If there was a method for checking that GA was mounted then you use that check before firing your event"}}
{"actor":{"display_login":"ajshortt"}}