greenkeeper[bot] on @octokit
greenkeeper[bot] on @octokit
chore(package): update @octokit… (compare)
greenkeeper[bot] on @octokit
greenkeeper[bot] on @octokit
chore(package): update @octokit… (compare)
cherifGsoul on document-inserted-removed-can6
Update after review (compare)
cherifGsoul on theme-3.0.0-pre.5
cherifGsoul on master
Update bit-doc-html-canjs (#544… (compare)
cherifGsoul on theme-3.0.0-pre.5
Update bit-doc-html-canjs Upda… (compare)
cherifGsoul on update-api-page
cherifGsoul on master
Update API page (#5432) * Upda… (compare)
greenkeeper[bot] on core-js-3.5.0
chore(package): update core-js … (compare)
can-component
docs: https://github.com/canjs/can-component/tree/master/docs
I am trying to track routes, I want to call google analytics when a route is changed.
I created the following js file..
import can from 'can';
import 'can/map/define/';
import 'can/route/pushstate/';
export default can.Control({
'route': function() {
// Matches every routing change, but gets passed no data.
console.log("Something changed!")
},
':page route': function(data) {
console.log("page change", data);
// Matches routes like #!todos/5,
// and will get passed {id: 5} as data.
},
':page/:item': function(data) {
console.log("page change", data);
// Matches routes like #!recipes/5,
// and will get passed {id: 5, type: 'recipes'} as data.
}
});
Then I import it into my app viewModal like this:
import 'app/utils/routing';
This doesn't work. I tried putting it on the bottom of the app view model with new Router(window);
like this page has https://v2.canjs.com/docs/can.Control.route.html However that also didn't work.
Could someone help me with what I am missing?
page: {
set function(val) {
console.log(‘page changed’, val);
return val;
}
}
page: {
set(newVal) {
if (newVal == 'listing') {
ga('set', { page: newVal + '/' + this.attr("item") , title: this.attr('title') });
ga('send', 'pageview');
} else {
ga('set', { page: newVal, title: this.attr('title') });
ga('send', 'pageview');
}
return newVal;
}
},