File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change
1
+ # 3.1.0 / 2019-08-09
2
+
3
+ - Add mapping of non-property fields to event_props.
4
+
1
5
# 3.0.0 / 2019-06-10
2
6
3
7
- Update Amplitude SDK to v5.2.2
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ var Amplitude = (module.exports = integration('Amplitude')
49
49
. option ( 'preferAnonymousIdForDeviceId' , false )
50
50
. option ( 'traitsToSetOnce' , [ ] )
51
51
. option ( 'traitsToIncrement' , [ ] )
52
+ . option ( 'appendFieldsToEventProps' , { } )
52
53
. tag ( '<script src="' + src + '">' ) ) ;
53
54
54
55
/**
@@ -253,6 +254,11 @@ function logEvent(track, dontSetRevenue) {
253
254
window . amplitude . getInstance ( ) . setUserProperties ( params ) ;
254
255
}
255
256
257
+ // Append extra fields to event_props
258
+ each ( function ( prop , field ) {
259
+ props [ prop ] = track . proxy ( field ) ;
260
+ } , this . options . appendFieldsToEventProps ) ;
261
+
256
262
// track the event
257
263
if ( options . groups ) {
258
264
window . amplitude
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @segment/analytics.js-integration-amplitude" ,
3
3
"description" : " The Amplitude analytics.js integration." ,
4
- "version" : " 3.0.1 " ,
4
+ "version" : " 3.1.0 " ,
5
5
"keywords" : [
6
6
" analytics.js" ,
7
7
" analytics.js-integration" ,
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ describe('Amplitude', function() {
64
64
. option ( 'traitsToSetOnce' , [ ] )
65
65
. option ( 'traitsToIncrement' , [ ] )
66
66
. option ( 'deviceIdFromUrlParam' , false )
67
+ . option ( 'appendFieldsToEventProps' , { } )
67
68
) ;
68
69
} ) ;
69
70
@@ -633,6 +634,18 @@ describe('Amplitude', function() {
633
634
analytics . page ( ) ;
634
635
analytics . called ( window . amplitude . getInstance ( ) . setDeviceId , 'example' ) ;
635
636
} ) ;
637
+
638
+ it ( 'should send an event with context properties mapped' , function ( ) {
639
+ amplitude . options . appendFieldsToEventProps = {
640
+ 'context.page.path' : 'pagePath'
641
+ } ;
642
+
643
+ analytics . track ( 'event' , { foo : 'bar' } ) ;
644
+ analytics . called ( window . amplitude . getInstance ( ) . logEvent , 'event' , {
645
+ foo : 'bar' ,
646
+ pagePath : '/context.html'
647
+ } ) ;
648
+ } ) ;
636
649
} ) ;
637
650
638
651
describe ( '#orderCompleted' , function ( ) {
You can’t perform that action at this time.
0 commit comments