Javascript API for Ecommerce Data

You can easily send events and properties for users for E-commerce

You have to send dates in unix timestamp format and all properties names should end with “_date”

1. Customer Activity

A customer can have following action with products. Replace them from ‘action_names’

  1. viewed,
  2. purchased,
  3. wishlist,
  4. add_to_cart,
  5. reviewed,
  6. shared,
  7. completed
  8. removed_from_cart

      _bOut.push(["customerActivity",'Email','action_name', {
                        'products': [{
                        'productId': 'xxx',
                        'sku': 'xxx', //optional
                        'productTitle': 'xxx',
                        'price': 'xxx',
                        'specialPrice': 'xxx', //optional
                        'status': 'xxx', //optional
                        'stockAvailability': 'xxx',
                        'pageURL': 'xxx', //optional
                        'brandName': 'bbbb', //optional
                        'pictureURL': '', //optional
                        'currency': 'xxx', //optional
                        'category': 'categories1',
                        'qty': '1' //optional(number of quantity added in cart)
                       }],
                        'specialPrice': 'xxx', //optional
                        'status': 'xxx', //optional
                        'stockAvailability': 'xxx',
                        'pageURL': 'xxx', //optional
                        'brandName': 'bbbb', //optional
                        'pictureURL': '', //optional
                        'currency': 'xxx', //optional
                        'category': 'categories1',
                        'cartInfo': {
                        'subtotalPrice': 11.94,
                        'abandonedCheckoutUrl' : 'http://www.your-url.com', //optional
                }
            }]);



Example


Add To Cart

            
    _bOut.push(["customerActivity",'bill@gates.com', 'add_to_cart', {
        'products': [{
                'productId': 'xxx',
                'sku': 'xxx', //optional
                'productTitle': 'xxx',
                'price': 'xxx',
                'specialPrice': 'xxx', //optional
                'status': 'xxx', //optional
                'stockAvailability': 'xxx',
                'pageURL': 'xxx', //optional
                'brandName': 'bbbb', //optional
                'pictureURL': '', //optional
                'currency': 'xxx', //optional
                'category': 'categories1',
                'qty': '1' //optional(number of quantity added in cart)
            }],
        'specialPrice': 'xxx', //optional
        'status': 'xxx', //optional
        'stockAvailability': 'xxx',
        'pageURL': 'xxx', //optional
        'brandName': 'bbbb', //optional
        'pictureURL': '', //optional
        'currency': 'xxx', //optional
        'category': 'categories1',
        'cartInfo': {
            'subtotalPrice': 11.94,
            'abandonedCheckoutUrl': 'http://www.your-url.com', //optional
        }
    }]);

Purchased

      _bOut.push(["customerActivity",'bill@gates.com','purchased', {
                'products': [{
                        'productId': 'xxx',
                        'sku': 'xxx', //optional
                        'productTitle': 'xxx',
                        'price': 'xxx',
                        'specialPrice': 'xxx', //optional
                        'status': 'xxx', //optional
                        'stockAvailability': 'xxx',
                        'brandName': 'xxx', //optional
                        'pageURL': 'xxx', //optional
                        'pictureURL': '', //optional
                        'currency': 'xxx', //mandatory
                        'category': "categories1,categories2,categories3'",
                        'qty': '1'//optional(number of quantity added in cart)
                    },
                    {
                        'productId': 'xxx2',
                        'sku': 'xxx2', //optional
                        'productTitle': 'xxx2',
                        'price': 'xxx2',
                        'specialPrice': 'xxx2', //optional
                        'status': 'xxx2', //optional
                        'stockAvailability': 'xxx2',
                        'brandName': 'xxx2', //optional
                        'pageURL': 'xxx2', //optional
                        'pictureURL': '', //optional
                        'currency': 'xxx2', //optional
                        'category': "categories1,categories2,categories3",
                        'qty': '1'//optional  (number of quantity added in cart)
                    }

                ],
                'cartInfo': {
                    'orderId': '34634678',
                    'shoppingCartNo': '68778783ad298f1c80c3bafcddeea', //optional
                    'subtotalPrice': 11.94,
                    'totalShipping': 0.06, //optional
                    'totalTaxes': 0.06, //optional
                    'totalDiscount': 0.06, //optional
                    'totalPrice': 12.00, //optional
                    'promocode': 'abcd', //optional
                    'abandonedCheckoutUrl': 'http://www.your-url.com', //optional
                    'financialStatus': 'paid' //optional
                }
           }]);

Removed From Cart

    _bOut.push(["customerActivity",'bill@gates.com', 'removed_from_cart', {
        'products': [{
                'productId': 'xxx',
                'sku': 'xxx', //optional
                'productTitle': 'xxx',
                'price': 'xxx',
                'specialPrice': 'xxx', //optional
                'status': 'xxx', //optional
                'brandName': 'bbbb', //optional
                'stockAvailability': 'xxx',
                'pageURL': 'xxx', //optional
                'pictureURL': '', //optional
                'currency': 'xxx', //optional
                'category': "categories1,categories2,categories3",
                'qty': '1'
            }],
        'cartInfo': {
            'subtotalPrice': '10'
        }
    }]);

Viewed

    _bOut.push(["customerActivity",'bill@gates.com', 'viewed', {
        'products': [{
                'productId': 'xxx',
                'sku': 'xxx',
                'productTitle': 'xxx',
                'price': 'xxx',
                'specialPrice': 'xxx',
                'brandName': 'bbbb',
                'status': 'xxx',
                'stockAvailability': 'xxx',
                'pageURL': 'xxx',
                'pictureURL': '',
                'currency': 'xxx',
                'category': "categories1,categories2,categories3"
            }]
    }]);

 

2. New Product is Added

You can send information about any new through this end point

     _bOut.push(["addProduct",{
           'productId': 'xxx',
           'sku': 'xxx', //optional
           'productTitle': 'xxx', //optional
           'price': 'xxx',
           'specialPrice': 'xxx', //optional
           'status': 'xxx', //optional
           'stockAvailability': 'xxx',
           'pageURL': 'xxx', //optional
           'pictureURL': 'xxx', //optional
           'currency': 'xxx'  //optional
      }]);

 

3. Existing Product is Edited

You can send information about any new through this end point.

You can disable a product through this API. You can also change stock availability through this API itself.

      _bOut.push(["editProduct",{
                'productId' : 'xxx',
                'sku' : 'xxx', //optional
                'productTitle' : 'xxx', //optional
                'price' : 'xxx',
                'specialPrice': 'xxx', //optional
                'status' : 'xxx', //optional
                'stockAvailability' : 'xxx',
                'pageURL' : 'xxx', //optional
                'pictureURL' : 'xxx', //optional
                'currency':'xxx'  //optional
         }]);

 

4. Order Status Update

Order is automatically created in customer action API. When a product is purchased, orderId is to be passed.

This API helps you updating orderStatus.

_bOut.push(["updateOrderStatus",orderId, orderStatus])

Order Status
——————-

Processing
Pending Payment
Suspected Fraud
Payment Review
Pending
On Hold
Complete
Closed
Canceled

Feel free to ping us or drop a line if you face any problems integrating getAmplify.