weixin_39550379
weixin_39550379
2020-12-07 10:23

Improved debugging

Hi again, the current debugging solution has two flaws:

  • You have to use chrome and the google analytics debugging extension
  • Tracking still happens, because the hits are still being sent

As documented here, you can do a bit more with google analytics for debugging.

I propose that debugging should be configured like this:

JavaScript
Vue.use(VueAnalytics, {
  debug: {
    enabled: true, // default false
    trace: true, // default false
    sendHitTask: false // default true
  }
})

Internally, it loads the https://www.google-analytics.com/analytics_debug.js (notice the _debug in the name) and sets the variable window.ga_debug = {trace: true}; accordingly to enable trace debugging.

If sendHitTask is false, it should set the google analytics variable sendHitTask to null to prevent the analytics from actually sending to server.

JavaScript
ga('set', 'sendHitTask', null);

Thoughts?

该提问来源于开源项目:MatteoGabriele/vue-analytics

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39559119 weixin_39559119 5月前

    hi , thanks again!

    the debug in vue-analytics only shows what you are doing tracking events, pageviews and using the set method, so you could also just enable that one without using the Chrome extension: but of course if you need more, you need that one.

    I never liked the extension because was logging too much and at the end I always wanted only: which page or event.

    This debug tool looks interesting and I will take a look at it for sure

    点赞 评论 复制链接分享
  • weixin_39559119 weixin_39559119 5月前

    I've published this new feature with v2.3.0

    see 0814cd530553acebad4c84204ec90cbca0303c7c

    点赞 评论 复制链接分享
  • weixin_39559119 weixin_39559119 5月前

    thanks again and let me know if works as expected :)

    点赞 评论 复制链接分享
  • weixin_39550379 weixin_39550379 5月前

    thanks! it works as expected. also, there was a typo in the readme. see #11

    点赞 评论 复制链接分享

相关推荐