Event tracking APIs

The methods below provide an easy way to track certain pre-defined events like Identify, Checkout, Add to Cart, Check-in, Buy, etc.

In addition the SDK supports tracking of certain events - App Open and Notification tracking natively. You can learn more about these events here.  Your application can also send custom JSON to Blueshift. 

 

1. Custom Events

The trackEventForEventName method helps the developer to track custom events created by them with custom attributes.

without parameters:

 

Objective c

- (void)trackEventForEventName:(NSString *)eventName canBatchThisEvent:(BOOL)isBatchEvent;

[[BlueShift sharedInstance] trackEventForEventName:@"your_custom_event_name" canBatchThisEvent:YES];
 

Swift

BlueShift.sharedInstance().trackEvent(forEventName: String, canBatchThisEvent: Bool)
BlueShift.sharedInstance().trackEvent(forEventName: "testing swift", canBatchThisEvent: false)

with parameters:

 

Objective C

- (void)trackEventForEventName:(NSString *)eventName andParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;

NSDictionary *params = @{
                            @"name":@"Ross Geller",
                            @"profession":@"paleontologist"
                        }
[[BlueShift sharedInstance] trackEventForEventName:@"your_custom_event_name" andParameters:params canBatchThisEvent:NO];
 

Swift

BlueShift.sharedInstance().trackEvent(forEventName: String!, andParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)

let dictionary = ["name": "shahas", "profession":"paleontologist"]
BlueShift.sharedInstance().trackEvent(forEventName: "test", andParameters: dictionary, canBatchThisEvent: false)
 

 

2. Identify

The identifyUser event is used for identifying the end-user logged into the app. The primary identifier used to identify a user is device id(recommended to IDFV). The device id is set during the SDK initialization and is automatically sent to Blueshift. In addition to sending the device id, we recommend that you set the email and customer id where ever available. This would ensure that we a user resets the device id, we can still attribute events and generate recommendations.

 

Objective C

- (void)identifyUserWithDetails:(NSDictionary *)details canBatchThisEvent:(BOOL)isBatchEvent;

NSDictionary *details = @{
                            @"name":@"Ross Geller",
                            @"profession":@"paleontologist"
                        }

[[BlueShift sharedInstance] identifyUserWithDetails:details canBatchThisEvent:YES];



- (void)identifyUserWithEmail:(NSString *)email andDetails:(NSDictionary *)details canBatchThisEvent:(BOOL)isBatchEvent;

NSDictionary *details = @{
                            @"name":@"Ross Geller",
                            @"profession":@"paleontologist"
                        }

[[BlueShift sharedInstance] identifyUserWithEmail:@"Your Email ID here" andDetails:details canBatchThisEvent:YES];
 

Swift

BlueShift.sharedInstance().identifyUser(withDetails: [AnyHashable : Any]!, canBatchThisEvent: Bool)

let dictionary = ["name": "shahas", "profession":"paleontologist"]
BlueShift.sharedInstance().identifyUser(withDetails:dictionary, canBatchThisEvent: false)

BlueShift.sharedInstance().identifyUser(withEmail: String!, andDetails: [AnyHashable : Any]!, canBatchThisEvent: Bool)

BlueShift.sharedInstance().identifyUser(withEmail: "Your Email Id here", andDetails: dictionary, canBatchThisEvent: false)
 

 

3. Screen View

You may call the trackScreenViewedForViewController method to send page_load(screen tracking) event.

 

Objective C

- (void)trackScreenViewedForViewController:(UIViewController *)viewController canBatchThisEvent:(BOOL)isBatchEvent;

[[BlueShift sharedInstance] trackScreenViewedForViewController:self canBatchThisEvent:YES];


- (void)trackScreenViewedForViewController:(UIViewController *)viewController withParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;

[[BlueShift sharedInstance] trackScreenViewedForViewController:self withParameters:parametersDictionary canBatchThisEvent:YES];
 

Swift

BlueShift.sharedInstance().trackScreenViewed(for: UIViewController!, canBatchThisEvent: Bool)
BlueShift.sharedInstance().trackScreenViewed(for: self, canBatchThisEvent: true)

BlueShift.sharedInstance().trackScreenViewed(for: UIViewController!, withParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)
BlueShift.sharedInstance().trackScreenViewed(for: self, withParameters: paramsDictionarh, canBatchThisEvent: true)
 

 

4. Product View

The trackProductViewedWithSKU method can be used to track views of a particular product. It also takes the common attributes like sku and category id. Developer is also allowed to pass additional parameters as NSDictionary.

 

Objective C

- (void)trackProductViewedWithSKU:(NSString *)sku andCategoryID:(NSInteger)categoryID canBatchThisEvent:(BOOL)isBatchEvent;

[[BlueShift sharedInstance] trackProductViewedWithSKU:@"Product SKU here" andCategoryID:@"Category ID here" canBatchThisEvent:YES/NO];
 

Swift

BlueShift.sharedInstance().trackProductViewed(withSKU: String!, andCategoryID: Int, canBatchThisEvent: Bool)

BlueShift.sharedInstance().trackProductViewed(withSKU: "Product SKU here", andCategoryID: CategoryID, canBatchThisEvent: true/false)

If any additional parameters are to be sent along.

 

Objective C

- (void)trackProductViewedWithSKU:(NSString *)sku andCategoryID:(NSInteger)categoryID withParameter:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;

[[BlueShift sharedInstance] trackProductViewedWithSKU:@"Product SKU here" andCategoryID:@"Category ID here" withParameter:parametersDictionary canBatchThisEvent:YES/NO];
 

Swift

BlueShift.sharedInstance().trackProductViewed(withSKU: String!, andCategoryID: Int, withParameter: [AnyHashable : Any]!, canBatchThisEvent: Bool)
BlueShift.sharedInstance().trackProductViewed(withSKU: "Product SKU here", andCategoryID: 1234, withParameter: paramsDictionary, canBatchThisEvent: false)
 

 

5. Add to Cart

The trackAddToCartWithSKU method can be used for tracking add to cart event. This can be called when the add to cart button is clicked. Or when the add to cart API call is complete.

 

Objective C

- (void)trackAddToCartWithSKU:(NSString *)sku andQuantity:(NSInteger)quantity canBatchThisEvent:(BOOL)isBatchEvent;

[[BlueShift sharedInstance] trackAddToCartWithSKU:@"Product SKU here" andQuantity:quantity canBatchThisEvent:YES/NO];
 

Swift

BlueShift.sharedInstance().trackAddToCart(withSKU: String!, andQuantity: Int, canBatchThisEvent: Bool)
BlueShift.sharedInstance().trackAddToCart(withSKU: "Product SKU here", andQuantity: quantity, canBatchThisEvent: false)

If any additional parameters are to be sent along.

 

Objective C

- (void)trackAddToCartWithSKU:(NSString *)sku andQuantity:(NSInteger)quantity andParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;

[[BlueShift sharedInstance] trackAddToCartWithSKU:@"Product SKU here" andQuantity:quantity andParameters:parametersDictionary canBatchThisEvent:YES/NO];
 

Swift

BlueShift.sharedInstance().trackAddToCart(withSKU: String!, andQuantity: Int, andParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)
BlueShift.sharedInstance().trackAddToCart(withSKU: "Product SKU", andQuantity: quantity, andParameters: paramsDictionary, canBatchThisEvent: true)
 

 

6. Checkout Cart

The trackCheckOutCartWithProducts method tracks the cart checkout event. The first argument to the method is array of products. This product model is included in the SDK. You may create instances and set the values in it using your product instance.

 

Objective C

- (void)trackCheckOutCartWithProducts:(NSArray *)products andRevenue:(float)revenue andDiscount:(float)discount andCoupon:(NSString *)coupon canBatchThisEvent:(BOOL)isBatchEvent;

BlueShiftProduct *product1 = [[BlueShiftProduct alloc] init];
[product1 setSku:@"PROM001"];
[product1 setPrice:100];
[product1 setQuantity:1];

BlueShiftProduct *product2 = [[BlueShiftProduct alloc] init];
[product2 setSku:@"SERSGQ002"];
[product2 setPrice:10];
[product2 setQuantity:2];

BlueShiftProduct *product3 = [[BlueShiftProduct alloc] init];
[product3 setSku:@"FERW006"];
[product3 setPrice:105];
[product3 setQuantity:1];

products = @[product1, product2, product3];

[[BlueShift sharedInstance] trackCheckOutCartWithProducts:products andRevenue:revenue andDiscount:discount andCoupon:coupon canBatchThisEvent:YES/NO];
 

Swift

BlueShift.sharedInstance().trackCheckOutCart(withProducts: [Any]!, andRevenue: Float, andDiscount: Float, andCoupon: String!, canBatchThisEvent: Bool)

let product1 = BlueShiftProduct()
product1.sku = "PRM123"
product1.price = 50
product1.quantity = 2

let product2 = BlueShiftProduct()
product2.sku = "PRM123"
product2.price = 50
product2.quantity = 2

let product3 = BlueShiftProduct()
product3.sku = "PRM123"
product3.price = 50
product3.quantity = 2

let products = [product1, product2, product3]
BlueShift.sharedInstance().trackCheckOutCart(withProducts: products, andRevenue: revenue, andDiscount: discount, andCoupon: coupon, canBatchThisEvent: true/false)

If any additional parameters are to be sent along.

 

Objective C

- (void)trackCheckOutCartWithProducts:(NSArray *)products andRevenue:(float)revenue andDiscount:(float)discount andCoupon:(NSString *)coupon andParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;

BlueShiftProduct *product1 = [[BlueShiftProduct alloc] init];
[product1 setSku:@"PROM001"];
[product1 setPrice:100];
[product1 setQuantity:1];

BlueShiftProduct *product2 = [[BlueShiftProduct alloc] init];
[product2 setSku:@"SERSGQ002"];
[product2 setPrice:10];
[product2 setQuantity:2];

BlueShiftProduct *product3 = [[BlueShiftProduct alloc] init];
[product3 setSku:@"FERW006"];
[product3 setPrice:105];
[product3 setQuantity:1];

products = @[product1, product2, product3];

[[BlueShift sharedInstance] trackCheckOutCartWithProducts:products andRevenue:revenue andDiscount:discount andCoupon:coupon andParameters:parametersDictionary canBatchThisEvent:YES/NO];
 

Swift

BlueShift.sharedInstance().trackCheckOutCart(withProducts: [Any]!, andRevenue: Float, andDiscount: Float, andCoupon: String!, andParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)

BlueShiftProduct *product1 = [[BlueShiftProduct alloc] init];
[product1 setSku:@"PROM001"];
[product1 setPrice:100];
[product1 setQuantity:1];

BlueShiftProduct *product2 = [[BlueShiftProduct alloc] init];
[product2 setSku:@"SERSGQ002"];
[product2 setPrice:10];
[product2 setQuantity:2];

BlueShiftProduct *product3 = [[BlueShiftProduct alloc] init];
[product3 setSku:@"FERW006"];
[product3 setPrice:105];
[product3 setQuantity:1];

products = @[product1, product2, product3];    

BlueShift.sharedInstance().trackCheckOutCart(withProducts: products, andRevenue: revenue, andDiscount: discount, andCoupon: coupon, andParameters: paramsDictionary, canBatchThisEvent: true/false)
 

 

7. Products purchase

The trackProductsPurchased allows the developer to track a completed product purchase.

 

Objective C

- (void)trackProductsPurchased:(NSArray *)products withOrderID:(NSString *)orderID andRevenue:(float)revenue andShippingCost:(float)shippingCost andDiscount:(float)discount andCoupon:(NSString *)coupon canBatchThisEvent:(BOOL)isBatchEvent;

BlueShiftProduct *product1 = [[BlueShiftProduct alloc] init];
[product1 setSku:@"PROM001"];
[product1 setPrice:100];
[product1 setQuantity:1];

BlueShiftProduct *product2 = [[BlueShiftProduct alloc] init];
[product2 setSku:@"SERSGQ002"];
[product2 setPrice:10];
[product2 setQuantity:2];

BlueShiftProduct *product3 = [[BlueShiftProduct alloc] init];
[product3 setSku:@"FERW006"];
[product3 setPrice:105];
[product3 setQuantity:1];

products = @[product1, product2, product3];

[[BlueShift sharedInstance] trackProductsPurchased:products withOrderID:orderID andRevenue:revenue andShippingCost:shippingCost andDiscount:discount andCoupon:coupon canBatchThisEvent:YES/NO];
 

Swift

BlueShift.sharedInstance().trackProductsPurchased([Any]!, withOrderID: String!, andRevenue: Float, andShippingCost: Float, andDiscount: Float, andCoupon: String!, canBatchThisEvent: Bool)

BlueShiftProduct *product1 = [[BlueShiftProduct alloc] init];
[product1 setSku:@"PROM001"];
[product1 setPrice:100];
[product1 setQuantity:1];

BlueShiftProduct *product2 = [[BlueShiftProduct alloc] init];
[product2 setSku:@"SERSGQ002"];
[product2 setPrice:10];
[product2 setQuantity:2];

BlueShiftProduct *product3 = [[BlueShiftProduct alloc] init];
[product3 setSku:@"FERW006"];
[product3 setPrice:105];
[product3 setQuantity:1];

products = @[product1, product2, product3];  

BlueShift.sharedInstance().trackProductsPurchased(products, withOrderID: orderID, andRevenue: revenue, andShippingCost: shippingCost, andDiscount: discount, andCoupon: coupon, canBatchThisEvent: true/false)

If any additional parameters are to be sent along.

 

Objective C

- (void)trackProductsPurchased:(NSArray *)products withOrderID:(NSString *)orderID andRevenue:(float)revenue andShippingCost:(float)shippingCost andDiscount:(float)discount andCoupon:(NSString *)coupon andParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;

BlueShiftProduct *product1 = [[BlueShiftProduct alloc] init];
[product1 setSku:@"PROM001"];
[product1 setPrice:100];
[product1 setQuantity:1];

BlueShiftProduct *product2 = [[BlueShiftProduct alloc] init];
[product2 setSku:@"SERSGQ002"];
[product2 setPrice:10];
[product2 setQuantity:2];

BlueShiftProduct *product3 = [[BlueShiftProduct alloc] init];
[product3 setSku:@"FERW006"];
[product3 setPrice:105];
[product3 setQuantity:1];

products = @[product1, product2, product3];

[[BlueShift sharedInstance] trackProductsPurchased:products withOrderID:orderID andRevenue:revenue andShippingCost:shippingCost andDiscount:discount andCoupon:coupon andParameters:parameters canBatchThisEvent:YES/NO];
 

Swift

BlueShift.sharedInstance().trackProductsPurchased([Any]!, withOrderID: String!, andRevenue: Float, andShippingCost: Float, andDiscount: Float, andCoupon: String!, andParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)

BlueShiftProduct *product1 = [[BlueShiftProduct alloc] init];
[product1 setSku:@"PROM001"];
[product1 setPrice:100];
[product1 setQuantity:1];

BlueShiftProduct *product2 = [[BlueShiftProduct alloc] init];
[product2 setSku:@"SERSGQ002"];
[product2 setPrice:10];
[product2 setQuantity:2];

BlueShiftProduct *product3 = [[BlueShiftProduct alloc] init];
[product3 setSku:@"FERW006"];
[product3 setPrice:105];
[product3 setQuantity:1];

products = @[product1, product2, product3]; 

BlueShift.sharedInstance().trackProductsPurchased(products, withOrderID: orderID, andRevenue: revenue, andShippingCost: shippingCost, andDiscount: discount, andCoupon: coupon, andParameters: paramsDictionary, canBatchThisEvent: true/false)
 

 

8. Purchase cancel

The trackPurchaseCancelForOrderID tracks the cancellation event for an completed order.

 

Objective C

- (void)trackPurchaseCancelForOrderID:(NSString *)orderID canBatchThisEvent:(BOOL)isBatchEvent;

[[BlueShift sharedInstance] trackPurchaseCancelForOrderID:orderID canBatchThisEvent:YES/NO];
 

Swift

BlueShift.sharedInstance().trackPurchaseCancel(forOrderID: String!, canBatchThisEvent: Bool)
BlueShift.sharedInstance().trackPurchaseCancel(forOrderID: orderID, canBatchThisEvent: true/false)

If any additional parameters are to be sent along.

 

Objective C

- (void)trackPurchaseCancelForOrderID:(NSString *)orderID andParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;

[[BlueShift sharedInstance] trackPurchaseCancelForOrderID:orderID andParameters:parameters canBatchThisEvent:YES/NO];
 

Swift

BlueShift.sharedInstance().trackPurchaseCancel(forOrderID: String!, andParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)
BlueShift.sharedInstance().trackPurchaseCancel(forOrderID: orderID, andParameters: paramsDictionary, canBatchThisEvent: true/false)
 

 

9. Purchase return

The trackPurchaseReturnForOrderID method tracks the purchase return. You may call this api once the purchase return Api call is complete.

 

Objective C

- (void)trackPurchaseReturnForOrderID:(NSString *)orderID andProducts:(NSArray *)products canBatchThisEvent:(BOOL)isBatchEvent;

BlueShiftProduct *product1 = [[BlueShiftProduct alloc] init];
[product1 setSku:@"PROM001"];
[product1 setPrice:100];
[product1 setQuantity:1];

BlueShiftProduct *product2 = [[BlueShiftProduct alloc] init];
[product2 setSku:@"SERSGQ002"];
[product2 setPrice:10];
[product2 setQuantity:2];

BlueShiftProduct *product3 = [[BlueShiftProduct alloc] init];
[product3 setSku:@"FERW006"];
[product3 setPrice:105];
[product3 setQuantity:1];

products = @[product1, product2, product3];

[[BlueShift sharedInstance] trackPurchaseReturnForOrderID:orderID andProducts:products canBatchThisEvent:YES/NO];
 

Swift

 BlueShift.sharedInstance().trackPurchaseReturn(forOrderID: String!, andProducts: [Any]!, canBatchThisEvent: Bool)

 BlueShiftProduct *product1 = [[BlueShiftProduct alloc] init];
[product1 setSku:@"PROM001"];
[product1 setPrice:100];
[product1 setQuantity:1];

BlueShiftProduct *product2 = [[BlueShiftProduct alloc] init];
[product2 setSku:@"SERSGQ002"];
[product2 setPrice:10];
[product2 setQuantity:2];

BlueShiftProduct *product3 = [[BlueShiftProduct alloc] init];
[product3 setSku:@"FERW006"];
[product3 setPrice:105];
[product3 setQuantity:1];

products = @[product1, product2, product3];
BlueShift.sharedInstance().trackPurchaseReturn(forOrderID: orderID, andProducts: dictionary, canBatchThisEvent: true/false)

If any additional parameters are to be sent along.

 

Objective C

- (void)trackPurchaseReturnForOrderID:(NSString *)orderID andProducts:(NSArray *)products andParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;

BlueShiftProduct *product1 = [[BlueShiftProduct alloc] init];
[product1 setSku:@"PROM001"];
[product1 setPrice:100];
[product1 setQuantity:1];

BlueShiftProduct *product2 = [[BlueShiftProduct alloc] init];
[product2 setSku:@"SERSGQ002"];
[product2 setPrice:10];
[product2 setQuantity:2];

BlueShiftProduct *product3 = [[BlueShiftProduct alloc] init];
[product3 setSku:@"FERW006"];
[product3 setPrice:105];
[product3 setQuantity:1];

products = @[product1, product2, product3];

[[BlueShift sharedInstance] trackPurchaseReturnForOrderID:orderID andProducts:products andParameters:parameters canBatchThisEvent:YES/NO];
 

Swift

BlueShift.sharedInstance().trackPurchaseReturn(forOrderID: String!, andProducts: [Any]!, andParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)

BlueShiftProduct *product1 = [[BlueShiftProduct alloc] init];
[product1 setSku:@"PROM001"];
[product1 setPrice:100];
[product1 setQuantity:1];

BlueShiftProduct *product2 = [[BlueShiftProduct alloc] init];
[product2 setSku:@"SERSGQ002"];
[product2 setPrice:10];
[product2 setQuantity:2];

BlueShiftProduct *product3 = [[BlueShiftProduct alloc] init];
[product3 setSku:@"FERW006"];
[product3 setPrice:105];
[product3 setQuantity:1];

products = @[product1, product2, product3];

BlueShift.sharedInstance().trackPurchaseReturn(forOrderID: orderID, andProducts: products, andParameters: paramsDictionary, canBatchThisEvent: true/false)

 

10. Product search

The trackProductSearchWithSkuArray helps tracking the search events inside host app. Call this method when a search is performed.

The method has 3 implementation, with optional filters and extra arguments.

 

Objective C

- (void)trackProductSearchWithSkuArray:(NSArray *)skuArray andNumberOfResults:(NSInteger)numberOfResults andPageNumber:(NSInteger)pageNumber andQuery:(NSString *)query andParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackProductSearch(withSkuArray: [Any]!, andNumberOfResults: Int, andPageNumber: Int, andQuery: String!, andParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)

With optional filters.

 

Objective C

- (void)trackProductSearchWithSkuArray:(NSArray *)skuArray andNumberOfResults:(NSInteger)numberOfResults andPageNumber:(NSInteger)pageNumber andQuery:(NSString *)query andFilters:(NSDictionary *)filters canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackProductSearch(withSkuArray: [Any]!, andNumberOfResults: Int, andPageNumber: Int, andQuery: String!, andFilters: [AnyHashable : Any]!, canBatchThisEvent: Bool)

With optionalAttr values

 

Objective C

- (void)trackProductSearchWithSkuArray:(NSArray *)skuArray andNumberOfResults:(NSInteger)numberOfResults andPageNumber:(NSInteger)pageNumber andQuery:(NSString *)query andFilters:(NSDictionary *)filters andParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackProductSearch(withSkuArray: [Any]!, andNumberOfResults: Int, andPageNumber: Int, andQuery: String!, andFilters: [AnyHashable : Any]!, andParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)
 

 

11. Email List

 

i. Subscribe for email list

The trackEmailListSubscriptionForEmail method can be used for tracking email subscription event.

 

Objective C

- (void)trackEmailListSubscriptionForEmail:(NSString *)email canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackEmailListSubscription(forEmail: String!, canBatchThisEvent: Bool)

With optional additional parameters

 

Objective C

- (void)trackEmailListSubscriptionForEmail:(NSString *)email andParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackEmailListSubscription(forEmail: String!, andParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)
 

 

ii. Unsubscribe from email list

The trackEmailListUnsubscriptionForEmail method can be used for tracking email unsubscription event.

 

Objective C

- (void)trackEmailListUnsubscriptionForEmail:(NSString *)email canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackEmailListUnsubscription(forEmail: String!, canBatchThisEvent: Bool)

With optional additional parameters

 

Objective C

- (void)trackEmailListUnsubscriptionForEmail:(NSString *)email andParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackEmailListUnsubscription(forEmail: String!, andParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)
 

 

12. Subscriptions

The APIs under this section is used to track the events on a subscription. 

 

i. Initialize

Initializes the subscription. If the subscription state is BlueShiftSubscriptionStateStart or BlueShiftSubscriptionStateUpgrade event "subscription_upgrade" is fired, else if the state is BlueShiftSubscriptionStateDowngrade, then event "subscription_downgrade" is fired.

 

Objective C

- (void)trackSubscriptionInitializationForSubscriptionState:(BlueShiftSubscriptionState)subscriptionState andCycleType:(NSString *)cycleType andCycleLength:(NSInteger)cycleLength andSubscriptionType:(NSString *)subscriptionType andPrice:(float)price andStartDate:(NSTimeInterval)startDate canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackSubscriptionInitialization(for: BlueShiftSubscriptionState, andCycleType: String!, andCycleLength: Int, andSubscriptionType: String!, andPrice: Float, andStartDate: TimeInterval, canBatchThisEvent: Bool)

With optional additional parameters

 

Objective C

- (void)trackSubscriptionInitializationForSubscriptionState:(BlueShiftSubscriptionState)subscriptionState andCycleType:(NSString *)cycleType andCycleLength:(NSInteger)cycleLength andSubscriptionType:(NSString *)subscriptionType andPrice:(float)price andStartDate:(NSTimeInterval)startDate andParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackSubscriptionInitialization(for: BlueShiftSubscriptionState, andCycleType: String!, andCycleLength: Int, andSubscriptionType: String!, andPrice: Float, andStartDate: TimeInterval, andParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)
 

 

ii. Pause

The trackSubscriptionPause method will downgrade your currently active subscription.

 

Objective C

- (void)trackSubscriptionPauseWithBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackSubscriptionPause(withBatchThisEvent: Bool)

With optional additional parameters

 

Objective C

- (void)trackSubscriptionPauseWithParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackSubscriptionPause(withParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)
 

 

iii. Resume/UnPause

The trackSubscriptionUnpause method will downgrade your currently paused subscription.

 

Objective C

- (void)trackSubscriptionUnpauseWithBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackSubscriptionUnpause(withBatchThisEvent: Bool)

With optional additional parameters

 

Objective C

- (void)trackSubscriptionUnpauseWithParameters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackSubscriptionUnpause(withParameters: [AnyHashable : Any]!, canBatchThisEvent: Bool)
 

 

iv. Cancel

The trackSubscriptionCancel can be used for tracking the cancellation of currently running subscription.

 

Objective C

- (void)trackSubscriptionCancelWithBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackSubscriptionCancel(withBatchThisEvent: Bool)

With optional additional parameters

 

Objective C

- (void)trackSubscriptionCancelWithParamters:(NSDictionary *)parameters canBatchThisEvent:(BOOL)isBatchEvent;
 

Swift

BlueShift.sharedInstance().trackSubscriptionCancel(withParamters: [AnyHashable : Any]!, canBatchThisEvent: Bool)
Was this article helpful?
0 out of 0 found this helpful