vue-analytics-facebook-pixel icon indicating copy to clipboard operation
vue-analytics-facebook-pixel copied to clipboard

enhancement request: integrate with vue-router

Open chrisbraddock opened this issue 8 years ago • 4 comments

Similar to vue-analytics, allow passing a router instance as an option:

import router from './router'
import VueFacebookPixel from 'vue-analytics-facebook-pixel'

Vue.use(VueFacebookPixel, { router })

and automatically fire 'PageView' on route change

chrisbraddock avatar Dec 14 '16 23:12 chrisbraddock

Sure thing, thanks!

PRs are welcome, if you are interested!

sobolevn avatar Dec 14 '16 23:12 sobolevn

If I get to it before you, for sure. :)

chrisbraddock avatar Dec 19 '16 04:12 chrisbraddock

According to Facebook Pixel documentation, all changes in the history state is automatically tracked as a PageView. Perhaps this feature is significant only in the cases when router is used in hash mode.

By default Facebook Pixel activates the HTML 5 History State API listener. This means that each time a new state appears in the history, such as history.pushState, Facebook Pixel fires a PageView event. Note that due to the way we designed Facebook Pixel's JavaScript code, you cannot fire more than one PageView event explicitly without this listener.

rafapg avatar Mar 05 '18 22:03 rafapg

@rafapg do you have any opportunity to investigate this?

sobolevn avatar Mar 06 '18 07:03 sobolevn