Skip to content

Commit 17ed91b

Browse files
author
Conroy Whitney and Jesse House
committed
[ScratchIt] Change page segment event from page_visit to track
* Fix linter warnings
1 parent 8f42dd2 commit 17ed91b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/scratch-it/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ var ScratchIt = module.exports = integration('Scratch-it Analytics')
2424
ScratchIt.prototype.initialize = function() {
2525
var self = this;
2626

27-
this.load(function(){
28-
if(!window.ScratchItAnalytics) {
27+
this.load(function() {
28+
if (!window.ScratchItAnalytics) {
2929
return null;
3030
}
3131

@@ -44,10 +44,12 @@ ScratchIt.prototype.loaded = function() {
4444
};
4545

4646
/**
47-
* Track.
47+
* Track an event.
4848
*
49+
* @api public
4950
* @param {Track} track
5051
*/
52+
5153
ScratchIt.prototype.track = function(track) {
5254
var parameters = track.properties();
5355
var event_type = parameters.event_type || 'track';
@@ -58,10 +60,12 @@ ScratchIt.prototype.track = function(track) {
5860
/**
5961
* Page.
6062
*
63+
* @api public
6164
* @param {Page} page
6265
*/
66+
6367
ScratchIt.prototype.page = function(page) {
6468
var customProperties = page.properties();
6569
del(customProperties, 'event_type');
66-
window._ScratchIt.track('page_visit', 'page_visit', customProperties);
70+
window._ScratchIt.track('track', 'page_visit', customProperties);
6771
};

lib/scratch-it/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ describe('ScratchIt', function() {
9191
});
9292
});
9393

94-
describe('#page', function(){
94+
describe('#page', function() {
9595
beforeEach(function() {
9696
analytics.stub(window._ScratchIt, 'track');
9797
});
9898

9999
it('should send a page tracking event', function() {
100100
analytics.page();
101-
analytics.called(window._ScratchIt.track, 'page_visit', 'page_visit');
101+
analytics.called(window._ScratchIt.track, 'track', 'page_visit');
102102
});
103103
});
104104
});

0 commit comments

Comments
 (0)