@@ -445,122 +445,131 @@ def create_content_review(self):
445
445
446
446
def create_order (self ):
447
447
# Sample $create_order event
448
+ order_properties = self .build_create_order_event ()
449
+ return self .client .track ("$create_order" , order_properties )
450
+
451
+ def create_order_with_warnings (self ):
452
+ # Sample $create_order event
453
+ order_properties = self .build_create_order_event ()
454
+ return self .client .track ("$create_order" , order_properties , include_warnings = True )
455
+
456
+ def build_create_order_event (self ):
448
457
order_properties = {
449
458
# Required Fields
450
- "$user_id" : self .user_id ,
459
+ "$user_id" : self .user_id ,
451
460
# Supported Fields
452
- "$session_id" : "gigtleqddo84l8cm15qe4il" ,
453
- "$order_id" : "ORDER-28168441" ,
454
- "$user_email" : self .user_email ,
455
- "$verification_phone_number" : "+123456789012" ,
456
- "$amount" : 115940000 , # $115.94
457
- "$currency_code" : "USD" ,
458
- "$billing_address" : {
459
- "$name" : "Bill Jones" ,
460
- "$phone" : "1-415-555-6041" ,
461
- "$address_1" : "2100 Main Street" ,
462
- "$address_2" : "Apt 3B" ,
463
- "$city" : "New London" ,
464
- "$region" : "New Hampshire" ,
465
- "$country" : "US" ,
466
- "$zipcode" : "03257"
461
+ "$session_id" : "gigtleqddo84l8cm15qe4il" ,
462
+ "$order_id" : "ORDER-28168441" ,
463
+ "$user_email" : self .user_email ,
464
+ "$verification_phone_number" : "+123456789012" ,
465
+ "$amount" : 115940000 , # $115.94
466
+ "$currency_code" : "USD" ,
467
+ "$billing_address" : {
468
+ "$name" : "Bill Jones" ,
469
+ "$phone" : "1-415-555-6041" ,
470
+ "$address_1" : "2100 Main Street" ,
471
+ "$address_2" : "Apt 3B" ,
472
+ "$city" : "New London" ,
473
+ "$region" : "New Hampshire" ,
474
+ "$country" : "US" ,
475
+ "$zipcode" : "03257"
467
476
},
468
- "$payment_methods" : [
477
+ "$payment_methods" : [
469
478
{
470
- "$payment_type" : "$credit_card" ,
471
- "$payment_gateway" : "$braintree" ,
472
- "$card_bin" : "542486" ,
473
- "$card_last4" : "4444"
479
+ "$payment_type" : "$credit_card" ,
480
+ "$payment_gateway" : "$braintree" ,
481
+ "$card_bin" : "542486" ,
482
+ "$card_last4" : "4444"
474
483
}
475
484
],
476
- "$ordered_from" : {
477
- "$store_id" : "123" ,
478
- "$store_address" : {
479
- "$name" : "Bill Jones" ,
480
- "$phone" : "1-415-555-6040" ,
481
- "$address_1" : "2100 Main Street" ,
482
- "$address_2" : "Apt 3B" ,
483
- "$city" : "New London" ,
484
- "$region" : "New Hampshire" ,
485
- "$country" : "US" ,
486
- "$zipcode" : "03257"
485
+ "$ordered_from" : {
486
+ "$store_id" : "123" ,
487
+ "$store_address" : {
488
+ "$name" : "Bill Jones" ,
489
+ "$phone" : "1-415-555-6040" ,
490
+ "$address_1" : "2100 Main Street" ,
491
+ "$address_2" : "Apt 3B" ,
492
+ "$city" : "New London" ,
493
+ "$region" : "New Hampshire" ,
494
+ "$country" : "US" ,
495
+ "$zipcode" : "03257"
487
496
}
488
497
},
489
- "$brand_name" : "sift" ,
490
- "$site_domain" : "sift.com" ,
491
- "$site_country" : "US" ,
492
- "$shipping_address" : {
493
- "$name" : "Bill Jones" ,
494
- "$phone" : "1-415-555-6041" ,
495
- "$address_1" : "2100 Main Street" ,
496
- "$address_2" : "Apt 3B" ,
497
- "$city" : "New London" ,
498
- "$region" : "New Hampshire" ,
499
- "$country" : "US" ,
500
- "$zipcode" : "03257"
498
+ "$brand_name" : "sift" ,
499
+ "$site_domain" : "sift.com" ,
500
+ "$site_country" : "US" ,
501
+ "$shipping_address" : {
502
+ "$name" : "Bill Jones" ,
503
+ "$phone" : "1-415-555-6041" ,
504
+ "$address_1" : "2100 Main Street" ,
505
+ "$address_2" : "Apt 3B" ,
506
+ "$city" : "New London" ,
507
+ "$region" : "New Hampshire" ,
508
+ "$country" : "US" ,
509
+ "$zipcode" : "03257"
501
510
},
502
- "$expedited_shipping" : True ,
503
- "$shipping_method" : "$physical" ,
504
- "$shipping_carrier" : "UPS" ,
511
+ "$expedited_shipping" : True ,
512
+ "$shipping_method" : "$physical" ,
513
+ "$shipping_carrier" : "UPS" ,
505
514
"$shipping_tracking_numbers" : ["1Z204E380338943508" , "1Z204E380338943509" ],
506
- "$items" : [
515
+ "$items" : [
507
516
{
508
- "$item_id" : "12344321" ,
509
- "$product_title" : "Microwavable Kettle Corn: Original Flavor" ,
510
- "$price" : 4990000 , # $4.99
511
- "$upc" : "097564307560" ,
512
- "$sku" : "03586005" ,
513
- "$brand" : "Peters Kettle Corn" ,
514
- "$manufacturer" : "Peters Kettle Corn" ,
515
- "$category" : "Food and Grocery" ,
516
- "$tags" : ["Popcorn" , "Snacks" , "On Sale" ],
517
- "$quantity" : 4
517
+ "$item_id" : "12344321" ,
518
+ "$product_title" : "Microwavable Kettle Corn: Original Flavor" ,
519
+ "$price" : 4990000 , # $4.99
520
+ "$upc" : "097564307560" ,
521
+ "$sku" : "03586005" ,
522
+ "$brand" : "Peters Kettle Corn" ,
523
+ "$manufacturer" : "Peters Kettle Corn" ,
524
+ "$category" : "Food and Grocery" ,
525
+ "$tags" : ["Popcorn" , "Snacks" , "On Sale" ],
526
+ "$quantity" : 4
518
527
},
519
528
{
520
- "$item_id" : "B004834GQO" ,
521
- "$product_title" : "The Slanket Blanket-Texas Tea" ,
522
- "$price" : 39990000 , # $39.99
523
- "$upc" : "6786211451001" ,
524
- "$sku" : "004834GQ" ,
525
- "$brand" : "Slanket" ,
526
- "$manufacturer" : "Slanket" ,
527
- "$category" : "Blankets & Throws" ,
528
- "$tags" : ["Awesome" , "Wintertime specials" ],
529
- "$color" : "Texas Tea" ,
530
- "$quantity" : 2
529
+ "$item_id" : "B004834GQO" ,
530
+ "$product_title" : "The Slanket Blanket-Texas Tea" ,
531
+ "$price" : 39990000 , # $39.99
532
+ "$upc" : "6786211451001" ,
533
+ "$sku" : "004834GQ" ,
534
+ "$brand" : "Slanket" ,
535
+ "$manufacturer" : "Slanket" ,
536
+ "$category" : "Blankets & Throws" ,
537
+ "$tags" : ["Awesome" , "Wintertime specials" ],
538
+ "$color" : "Texas Tea" ,
539
+ "$quantity" : 2
531
540
}
532
541
],
533
542
# For marketplaces, use $seller_user_id to identify the seller
534
- "$seller_user_id" : "slinkys_emporium" ,
543
+ "$seller_user_id" : "slinkys_emporium" ,
535
544
536
- "$promotions" : [
545
+ "$promotions" : [
537
546
{
538
- "$promotion_id" : "FirstTimeBuyer" ,
539
- "$status" : "$success" ,
540
- "$description" : "$5 off" ,
541
- "$discount" : {
542
- "$amount" : 5000000 , # $5.00
543
- "$currency_code" : "USD" ,
544
- "$minimum_purchase_amount" : 25000000 # $25.00
547
+ "$promotion_id" : "FirstTimeBuyer" ,
548
+ "$status" : "$success" ,
549
+ "$description" : "$5 off" ,
550
+ "$discount" : {
551
+ "$amount" : 5000000 , # $5.00
552
+ "$currency_code" : "USD" ,
553
+ "$minimum_purchase_amount" : 25000000 # $25.00
545
554
}
546
555
}
547
556
],
548
557
549
558
# Sample Custom Fields
550
- "digital_wallet" : "apple_pay" , # "google_wallet", etc.
551
- "coupon_code" : "dollarMadness" ,
552
- "shipping_choice" : "FedEx Ground Courier" ,
553
- "is_first_time_buyer" : False ,
559
+ "digital_wallet" : "apple_pay" , # "google_wallet", etc.
560
+ "coupon_code" : "dollarMadness" ,
561
+ "shipping_choice" : "FedEx Ground Courier" ,
562
+ "is_first_time_buyer" : False ,
554
563
555
564
# Send this information from a BROWSER client.
556
- "$browser" : {
557
- "$user_agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36" ,
558
- "$accept_language" : "en-US" ,
559
- "$content_language" : "en-GB"
565
+ "$browser" : {
566
+ "$user_agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36" ,
567
+ "$accept_language" : "en-US" ,
568
+ "$content_language" : "en-GB"
560
569
}
561
570
}
562
- return self . client . track ( "$create_order" , order_properties )
563
-
571
+ return order_properties
572
+
564
573
def flag_content (self ):
565
574
# Sample $flag_content event
566
575
flag_content_properties = {
0 commit comments