wemake-services / vue-analytics-facebook-pixel

A small wrapper around Facebook Pixel API
MIT License
24 stars 19 forks source link

enhancement request: integrate with vue-router #1

Open chrisbraddock opened 7 years ago

chrisbraddock commented 7 years ago

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

sobolevn commented 7 years ago

Sure thing, thanks!

PRs are welcome, if you are interested!

chrisbraddock commented 7 years ago

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

rafapg commented 6 years ago

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.

sobolevn commented 6 years ago

@rafapg do you have any opportunity to investigate this?