This repository was archived by the owner on Aug 14, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -261,7 +261,7 @@ GA.prototype.track = function(track, options) {
261
261
262
262
var payload = {
263
263
eventAction : track . event ( ) ,
264
- eventCategory : props . category || this . _category || 'All' ,
264
+ eventCategory : track . category ( ) || this . _category || 'All' ,
265
265
eventLabel : props . label ,
266
266
eventValue : formatValue ( props . value || track . revenue ( ) ) ,
267
267
nonInteraction : ! ! ( props . nonInteraction || opts . nonInteraction )
@@ -424,7 +424,7 @@ GA.prototype.trackClassic = function(track, options) {
424
424
var props = track . properties ( ) ;
425
425
var revenue = track . revenue ( ) ;
426
426
var event = track . event ( ) ;
427
- var category = this . _category || props . category || 'All' ;
427
+ var category = this . _category || track . category ( ) || 'All' ;
428
428
var label = props . label ;
429
429
var value = formatValue ( revenue || props . value ) ;
430
430
var nonInteraction = ! ! ( props . nonInteraction || opts . nonInteraction ) ;
Original file line number Diff line number Diff line change @@ -455,6 +455,17 @@ describe('Google Analytics', function() {
455
455
} ) ;
456
456
} ) ;
457
457
458
+ it ( 'should send an event and map category with a capital C' , function ( ) {
459
+ analytics . track ( 'event' , { Category : 'blah' } ) ;
460
+ analytics . called ( window . ga , 'send' , 'event' , {
461
+ eventCategory : 'blah' ,
462
+ eventAction : 'event' ,
463
+ eventLabel : undefined ,
464
+ eventValue : 0 ,
465
+ nonInteraction : false
466
+ } ) ;
467
+ } ) ;
468
+
458
469
it ( 'should send an event with context' , function ( ) {
459
470
analytics . track ( 'event' , { } , {
460
471
campaign : {
You can’t perform that action at this time.
0 commit comments