@@ -161,6 +161,7 @@ describe('DoubleClick', function () {
161
161
var sdkSettings = {
162
162
advertiserId : '123456' ,
163
163
customVariables : '[{"jsmap":null,"map":"Total Amount","maptype":"EventAttributeClass.Name","value":"u1"},{"jsmap":null,"map":"color","maptype":"EventAttributeClass.Name","value":"u2"}]' ,
164
+ customParams : '[{"jsmap":null,"map":"product_id","maptype":"EventAttributeClass.Name","value":"dc_product_id"},{"jsmap":null,"map":"category","maptype":"EventAttributeClass.Name","value":"dc_category"}]' ,
164
165
eventMapping : '[{"jsmap":"-1978027768","map":"-1711833867978608722","maptype":"EventClass.Id","value":"group tag2;activity tag2"},{"jsmap":"-1107730368","map":"-3234618101041058100","maptype":"EventClass.Id","value":"group tag3;activity tag3"},{"jsmap":"-1592184962","map":"-4153695833896571372","maptype":"EventClassDetails.Id","value":"group tag4;activity tag4"}]'
165
166
} ;
166
167
// You may require userAttributes or userIdentities to be passed into initialization
@@ -504,6 +505,34 @@ describe('DoubleClick', function () {
504
505
done ( ) ;
505
506
} ) ;
506
507
508
+ it ( 'should log event with custom field mappings' , function ( done ) {
509
+ window . dataLayer = [ ] ;
510
+ mParticle . forwarder . process ( {
511
+ EventDataType : MessageTypes . PageEvent ,
512
+ EventCategory : mParticle . EventType . Unknown ,
513
+ EventName : 'Test Event' ,
514
+ EventAttributes : {
515
+ 'product_id' : '12345' ,
516
+ 'category' : 'electronics' ,
517
+ 'Total Amount' : 123 ,
518
+ 'color' : 'blue'
519
+ } ,
520
+ CustomFlags : {
521
+ 'DoubleClick.Counter' : 'standard'
522
+ }
523
+ } ) ;
524
+ window . dataLayer [ 0 ] [ 0 ] . should . equal ( 'event' ) ;
525
+ window . dataLayer [ 0 ] [ 1 ] . should . equal ( 'conversion' ) ;
526
+ window . dataLayer [ 0 ] [ 2 ] . should . have . property ( 'u1' , 123 ) ;
527
+ window . dataLayer [ 0 ] [ 2 ] . should . have . property ( 'u2' , 'blue' ) ;
528
+ window . dataLayer [ 0 ] [ 2 ] . should . have . property ( 'dc_custom_params' ) ;
529
+ window . dataLayer [ 0 ] [ 2 ] . dc_custom_params . should . have . property ( 'dc_product_id' , '12345' ) ;
530
+ window . dataLayer [ 0 ] [ 2 ] . dc_custom_params . should . have . property ( 'dc_category' , 'electronics' ) ;
531
+ window . dataLayer [ 0 ] [ 2 ] . should . have . property ( 'send_to' , 'DC-123456/group tag2/activity tag2+standard' ) ;
532
+
533
+ done ( ) ;
534
+ } ) ;
535
+
507
536
describe ( 'Consent State' , function ( ) {
508
537
var consentMap = [
509
538
{
@@ -544,6 +573,7 @@ describe('DoubleClick', function () {
544
573
'[{"jsmap":null,"map":"Some_consent","maptype":"ConsentPurposes","value":"ad_user_data"},{"jsmap":null,"map":"Storage_consent","maptype":"ConsentPurposes","value":"analytics_storage"},{"jsmap":null,"map":"Other_test_consent","maptype":"ConsentPurposes","value":"ad_storage"},{"jsmap":null,"map":"Test_consent","maptype":"ConsentPurposes","value":"ad_personalization"}]' ,
545
574
eventMapping : '[]' ,
546
575
customVariables : '[]' ,
576
+ customParams : '[]' ,
547
577
} ,
548
578
reportService . cb ,
549
579
true
@@ -579,6 +609,7 @@ describe('DoubleClick', function () {
579
609
defaultAnalyticsStorageConsentWeb : 'Granted' ,
580
610
eventMapping : '[]' ,
581
611
customVariables : '[]' ,
612
+ customParams : '[]' ,
582
613
} ,
583
614
reportService . cb ,
584
615
true
@@ -631,6 +662,7 @@ describe('DoubleClick', function () {
631
662
defaultAnalyticsStorageConsentWeb : 'Unspecified' ,
632
663
eventMapping : '[]' ,
633
664
customVariables : '[]' ,
665
+ customParams : '[]' ,
634
666
} ,
635
667
reportService . cb ,
636
668
true
@@ -663,6 +695,7 @@ describe('DoubleClick', function () {
663
695
consentMappingWeb : JSON . stringify ( consentMap ) ,
664
696
eventMapping : '[]' ,
665
697
customVariables : '[]' ,
698
+ customParams : '[]' ,
666
699
} ,
667
700
reportService . cb ,
668
701
true
@@ -829,6 +862,7 @@ describe('DoubleClick', function () {
829
862
defaultAnalyticsStorageConsentWeb : 'Granted' ,
830
863
eventMapping : '[]' ,
831
864
customVariables : '[]' ,
865
+ customParams : '[]' ,
832
866
} ,
833
867
reportService . cb ,
834
868
true
@@ -1010,6 +1044,7 @@ describe('DoubleClick', function () {
1010
1044
consentMappingWeb : JSON . stringify ( consentMap ) ,
1011
1045
eventMapping : '[]' ,
1012
1046
customVariables : '[]' ,
1047
+ customParams : '[]' ,
1013
1048
} ,
1014
1049
reportService . cb ,
1015
1050
true
@@ -1074,6 +1109,7 @@ describe('DoubleClick', function () {
1074
1109
enableGtag : 'True' ,
1075
1110
eventMapping : '[]' ,
1076
1111
customVariables : '[]' ,
1112
+ customParams : '[]' ,
1077
1113
} ,
1078
1114
reportService . cb ,
1079
1115
true
@@ -1153,6 +1189,7 @@ describe('DoubleClick', function () {
1153
1189
defaultAnalyticsStorageConsentWeb : 'Denied' ,
1154
1190
eventMapping : '[]' ,
1155
1191
customVariables : '[]' ,
1192
+ customParams : '[]' ,
1156
1193
} ,
1157
1194
reportService . cb ,
1158
1195
true
0 commit comments