diff --git a/lib/index.js b/lib/index.js index 72f8290..e1c7f52 100644 --- a/lib/index.js +++ b/lib/index.js @@ -56,8 +56,8 @@ Vero.prototype.loaded = function() { * @param {Page} page */ -Vero.prototype.page = function() { - push('trackPageview'); +Vero.prototype.page = function(page) { + push('track', 'viewed_page', page.properties(), { source: 'segment' }); }; /** diff --git a/test/index.test.js b/test/index.test.js index 141335e..5fdef1d 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -72,9 +72,15 @@ describe('Vero', function() { analytics.stub(window._veroq, 'push'); }); - it('should push "trackPageview"', function() { - analytics.page(); - analytics.called(window._veroq.push, ['trackPageview']); + it('should push "viewed_page"', function() { + analytics.page({ referrer: 'http://localhost:9876/?id=42' }); + analytics.called(window._veroq.push, ['track', 'viewed_page', { + referrer: 'http://localhost:9876/?id=42', + path: '/context.html', + search: '', + title: '', + url: 'http://localhost:9876/context.html' + },{ source: 'segment' }]); }); });