@@ -891,7 +891,8 @@ describe('Google Analytics', function() {
891
891
category : 'cat 1' ,
892
892
sku : 'p-298' ,
893
893
testDimension : true ,
894
- testMetric : true
894
+ testMetric : true ,
895
+ position : 4
895
896
} ) ;
896
897
897
898
analytics . assert ( window . ga . args . length === 5 ) ;
@@ -906,7 +907,48 @@ describe('Google Analytics', function() {
906
907
variant : undefined ,
907
908
currency : 'CAD' ,
908
909
metric1 : 'true' ,
909
- dimension1 : 'true'
910
+ dimension1 : 'true' ,
911
+ position : 4
912
+ } ] ) ;
913
+ analytics . deepEqual ( toArray ( window . ga . args [ 3 ] ) , [ 'ec:setAction' , 'add' , { } ] ) ;
914
+ analytics . deepEqual ( toArray ( window . ga . args [ 4 ] ) , [ 'send' , 'event' , 'cat 1' , 'product added' , {
915
+ dimension1 : 'true' ,
916
+ metric1 : 'true' ,
917
+ nonInteraction : 1
918
+ } ] ) ;
919
+ } ) ;
920
+
921
+ it ( 'should handle float positions for product data' , function ( ) {
922
+ ga . options . setAllMappedProps = false ;
923
+ ga . options . dimensions = { testDimension : 'dimension1' } ;
924
+ ga . options . metrics = { testMetric : 'metric1' } ;
925
+
926
+ analytics . track ( 'product added' , {
927
+ currency : 'CAD' ,
928
+ quantity : 1 ,
929
+ price : 24.75 ,
930
+ name : 'my product' ,
931
+ category : 'cat 1' ,
932
+ sku : 'p-298' ,
933
+ testDimension : true ,
934
+ testMetric : true ,
935
+ position : 4.5
936
+ } ) ;
937
+
938
+ analytics . assert ( window . ga . args . length === 5 ) ;
939
+ analytics . deepEqual ( toArray ( window . ga . args [ 1 ] ) , [ 'set' , '&cu' , 'CAD' ] ) ;
940
+ analytics . deepEqual ( toArray ( window . ga . args [ 2 ] ) , [ 'ec:addProduct' , {
941
+ id : 'p-298' ,
942
+ name : 'my product' ,
943
+ category : 'cat 1' ,
944
+ quantity : 1 ,
945
+ price : 24.75 ,
946
+ brand : undefined ,
947
+ variant : undefined ,
948
+ currency : 'CAD' ,
949
+ metric1 : 'true' ,
950
+ dimension1 : 'true' ,
951
+ position : 5
910
952
} ] ) ;
911
953
analytics . deepEqual ( toArray ( window . ga . args [ 3 ] ) , [ 'ec:setAction' , 'add' , { } ] ) ;
912
954
analytics . deepEqual ( toArray ( window . ga . args [ 4 ] ) , [ 'send' , 'event' , 'cat 1' , 'product added' , {
0 commit comments