Product object

Prev Next

Product object is required for revenue tracking, recommendation engine, and campaigns such as cart reminder. This article explains how you can set the product object and product attributes.

Set product object

Once you create a product object, you can set its attributes. You can set predefined (e.g., color, size, voucher name, sub-category, etc.) and custom attributes.

your title goes here
If you pass any nil/null or empty string to this method, it will return an empty and invalid product object. Any product-related operations will ignore an invalid product object.

The following parameters are required for the product object:

ParameterData Type
productIDString
nameString
taxonomyArray (of string)
imageURLString
priceDouble
currencyString

Method Signature

+(InsiderProduct *)createNewProductWithID:(NSString *)productID name:(NSString *)name taxonomy:(NSArray *)taxonomy imageURL:(NSString *)imageURL price:(double)price currency:(NSString *)currency;

Method Examples

 NSArray *taxonomy = [NSArray arrayWithObjects: @"taxonomy1", @"taxonomy2", @"taxonomy3", nil];
    InsiderProduct *insiderExampleProduct = [Insider createNewProductWithID:@"productID" name:@"productName" taxonomy:taxonomy imageURL:@"imageURL" price:1000.5 currency:@"currency"];
let taxonomy = ["taxonomy1", "taxonomy2", "taxonomy3"]
        let insiderExampleProduct = Insider.createNewProduct(withID: "productID", name: "productName", taxonomy: taxonomy, imageURL: "imageUrl", price: 1000.5, currency: "currency")
your title goes here
Make sure to set the attributes in the given data types, and set no attribute as nil/null or as an empty string. 

Set color attribute

This method allows you to set the color attribute of your Insider product object. 

ParameterData Type
colorString

Method Signature

-(InsiderProduct*(^)(NSString *))setColor;

Method Examples

insiderExampleProduct.setColor(@"color");
insiderExampleProduct?.setColor()("color")

Set voucher name attribute

This method allows you to set the voucher name attribute of your Insider product object. 

ParameterData Type
voucherNameString

Method Signature

-(InsiderProduct*(^)(NSString *))setVoucherName;

Method Examples

insiderExampleProduct.setVoucherName(@"voucherName");
insiderExampleProduct?.setVoucherName()("voucherName")

Set voucher discount attribute

This method allows you to set the voucher discount attribute of your Insider product object. 

ParameterData Type
voucherDiscountDouble

Method Signature

-(InsiderProduct*(^)(double))setVoucherDiscount;

Method Examples

insiderExampleProduct.setVoucherDiscount(10.5);
insiderExampleProduct?.setVoucherDiscount()(10.5)

Set promotion name attribute

This method allows you to set the promotion name attribute of your Insider product object. 

ParameterData Type
promotionNameString

Method Signature

-(InsiderProduct*(^)(NSString *))setPromotionName;

Method Examples

insiderExampleProduct.setPromotionName(@"promotionName");
insiderExampleProduct?.setPromotionName()("promotionName")

Set promotion discount attribute

This method allows you to set the promotion discount attribute of your Insider product object. 

ParameterData Type
promotionDiscountDouble

Method Signature

-(InsiderProduct*(^)(double))setPromotionDiscount;

Method Examples

insiderExampleProduct.setPromotionDiscount(10.5);
insiderExampleProduct?.setPromotionDiscount()(10.5)

Set GroupCode attribute

This method allows you to set the groupcode of your Insider product object. 

ParameterData Type
groupcodeString

Method Signature

-(InsiderProduct*(^)(NSString *))setGroupCode;

Method Example

insiderExampleProduct.setGroupCode(@"groupCode");
insiderExampleProduct?.setGroupCode()("groupCode")

Set Size attribute

This method allows you to set the size attribute of your Insider product object. 

ParameterData Type
sizeString

Method Signature

-(InsiderProduct*(^)(NSString *))setSize;

Method Examples

insiderExampleProduct.setSize(@"size");
insiderExampleProduct?.setSize()("size")

Set sale price attribute

This method allows you to set the sale price attribute of your Insider product object. 

ParameterData Type
salePriceDouble

Method Signature

-(InsiderProduct*(^)(double))setSalePrice;

Method Examples

insiderExampleProduct.setSalePrice(10.5);
insiderExampleProduct?.setSalePrice()(10.5)

Set shipping cost attribute

This method allows you to set the shipping cost attribute of your Insider product object. 

ParameterData Type
shippingCostDouble

Method Signature

-(InsiderProduct*(^)(double))setShippingCost;

Method Examples

insiderExampleProduct.setShippingCost(10.5);
insiderExampleProduct?.setShippingCost()(10.5)

Set quantity attribute

This method allows you to set the quantity attribute of your Insider product object. 

ParameterData Type
quantityInteger

Method Signature

-(InsiderProduct*(^)(int))setQuantity;

Method Examples

insiderExampleProduct.setQuantity(10);
insiderExampleProduct?.setQuantity()(10)

Set stock attribute

This method allows you to set the stock attribute of your Insider product object. 

ParameterData Type
stockInteger

Method Signature

-(InsiderProduct*(^)(int))setStock;

Method Examples

insiderExampleProduct.setStock(10);
insiderExampleProduct?.setStock()(10)

Set InStock attribute

This method allows you to set the InStock attribute for your Insider product object.

Method Signature

-(InsiderProduct *(^)(BOOL))setInStock

Method Example

insiderExampleProduct.setInStock(true);
insiderExampleProduct?.setInStock()(true)

Set brand attribute

This method allows you to set the brand of your Insider product object. 

Method Signature

-(InsiderProduct*(^)(NSString *))setBrand;

Method Examples

insiderExampleProduct.setBrand(@"brand");
insiderExampleProduct?.setBrand()("brand")

Set stock keeping unit attribute

This method allows you to set the stock keeping unit of your Insider product object.

Method Signature

-(InsiderProduct*(^)(NSString *))setSku;

Method Examples

insiderExampleProduct.setSku(@"sku");
insiderExampleProduct?.setSku()("sku")

Set gender attribute

This method allows you to set the gender of your Insider product object.

Method Signature

-(InsiderProduct*(^)(NSString *))setGender;

Method Examples

insiderExampleProduct.setGender(@"gender");
insiderExampleProduct?.setGender()("gender")

Set multipack attribute

This method allows you to set the multipack of your Insider product object.

Method Signature

-(InsiderProduct*(^)(NSString *))setMultipack;

Method Examples

insiderExampleProduct.setMultipack(@"multipack");
insiderExampleProduct?.setMultipack()("multipack")

Set product type attribute

This method allows you to set the product type of your Insider product object.

Method Signature

-(InsiderProduct*(^)(NSString *))setProductType;

Method Examples

insiderExampleProduct.setProductType(@"productType");
insiderExampleProduct?.setProductType()("productType")

Set global trade item number attribute

This method allows you to set the global trade item number of your Insider product object.

Method Signature

-(InsiderProduct*(^)(NSString *))setGtin;

Method Examples

insiderExampleProduct.setGtin(@"gtin");
insiderExampleProduct?.setGtin()("gtin")

Set description attribute

This method allows you to set the description of your Insider product object.

Method Signature

-(InsiderProduct*(^)(NSString *))setDescription;

Method Examples

insiderExampleProduct.setDescription(@"description");
insiderExampleProduct?.setDescription()("description")

Set tags attribute

This method allows you to set the tags of your Insider product object.

Method Signature

-(InsiderProduct*(^)(NSArray<NSString *> *))setTags;

Method Examples

insiderExampleProduct.setTags(@[@"tag1", @"tag2"]);
insiderExampleProduct?.setTags()(["tag1", "tag2"])

Set custom string attribute

This method allows you to set the custom string attribute for your Insider product object.

your title goes here
Your attribute key should be lowercase and should not include any special character, non-Latin character or any space. Otherwise, this attribute will be ignored. You can use underscores.
ParameterData Type
keyString
valueString

Method Signature

-(InsiderProduct*(^)(NSString *, NSString *))setCustomAttributeWithString;

Method Examples

insiderExampleProduct.setCustomAttributeWithString(@"key", @"value");
insiderExampleProduct?.setCustomAttributeWithString()("key", "value")

Set custom integer attribute

This method allows you to set the custom integer attribute for your Insider product object.

your title goes here
Your attribute key should be lowercase and should not include any special character, non-Latin character or any space. Otherwise, this attribute will be ignored. You can use underscores.
ParameterData Type
keyString
valueInteger

Method Signature

-(InsiderProduct*(^)(NSString *, int))setCustomAttributeWithInt;

Method Examples

insiderExampleProduct.setCustomAttributeWithInt(@"key", 10);
insiderExampleProduct?.setCustomAttributeWithInt()("key", 10)

Set custom boolean attribute

This method allows you to set the custom boolean attribute for your Insider product object.

your title goes here
Your attribute key should be lowercase and should not include any special character, non-Latin character or any space. Otherwise, this attribute will be ignored. You can use underscores.
ParameterData Type
keyString
valueBoolean

Method Signature

-(InsiderProduct *(^)(NSString *, bool))setCustomAttributeWithBoolean;

Method Examples

insiderExampleProduct.setCustomAttributeWithBoolean(@"key", true);
insiderExampleProduct?.setCustomAttributeWithBoolean()("key", true)

Set custom double attribute

This method allows you to set the custom double attribute for your Insider product object.

your title goes here
Your attribute key should be lowercase and should not include any special character, non-Latin character or any space. Otherwise, this attribute will be ignored. You can use underscores.
ParameterData Type
keyString
valueDouble

Method Signature

-(InsiderProduct*(^)(NSString *, double))setCustomAttributeWithDouble;

Method Examples

insiderExampleProduct.setCustomAttributeWithDouble(@"key", 10.5);
insiderExampleProduct?.setCustomAttributeWithDouble()("key", 10.5)

Set custom date attribute

This method allows you to set the custom date attribute for your Insider product object.

your title goes here
Your attribute key should be lowercase and should not include any special character, non-Latin character or any space. Otherwise, this attribute will be ignored. You can use underscores.
ParameterData Type
keyString
valueDate object

Method Signature

-(InsiderProduct*(^)(NSString *, NSDate *))setCustomAttributeWithDate;

Method Examples

  NSDate *date = [NSDate date];
  insiderExampleProduct.setCustomAttributeWithDate(@"key", date);
let date = Date()
insiderExampleProduct?.setCustomAttributeWithDate()("key", date)

Set custom array of string attribute

This method allows you to set the custom array of string attribute for your Insider product object.

your title goes here
Your attribute key should be lowercase and should not include any special character, non-Latin character or any space. Otherwise, this attribute will be ignored. You can use underscores.
ParameterData Type
keyString
valueArray (of string)

Method Signature

- (InsiderProduct*(^)(NSString *, NSArray<NSString *> *))setCustomAttributeWithStringArray;

Method Examples

InsiderProduct *insiderExampleProduct = [Insider createNewProductWithID:@"product_id"
                                                     name:@"product_name"
                                                 taxonomy:@[@"taxonomy_1", @"taxonomy_2"]
                                                 imageURL:@"https://useinsider.com/image_url"
                                                    price:123.45
                                                 currency:@"USD"];

NSArray<NSString *> *stringArray = @[@"value1", @"value2", @"value3"];
[insiderExampleProduct setCustomAttributeWithStringArray](@"key", stringArray);
let insiderExampleProduct = Insider.createNewProduct(
    withID: "product_id",
    name: "product_name",
    taxonomy: ["taxonomy_1", "taxonomy_2"],
    imageURL: "https://useinsider.com/image_url",
    price: 123.45,
    currency: "USD"
)

let stringArray = ["value1", "value2", "value2"]
insiderExampleProduct?.setCustomAttributeWithStringArray()("key", stringArray)

Set custom array of number attribute

This method allows you to set the custom array of number attribute for your Insider product object.

your title goes here
Your attribute key should be only numbers. Otherwise, this attribute will be ignored.
ParameterData Type
keyNumber
valueArray (of number)

Method Signature

- (InsiderProduct*(^)(NSString *, NSArray<NSNumber *> *))setCustomAttributeWithNumericArray;

Method Examples

InsiderProduct *insiderExampleProduct = [Insider createNewProductWithID:@"product_id"
                                                     name:@"product_name"
                                                 taxonomy:@[@"taxonomy_1", @"taxonomy_2"]
                                                 imageURL:@"https://useinsider.com/image_url"
                                                    price:123.45
                                                 currency:@"USD"];

[insiderExampleProduct setCustomAttributeWithNumericArray](@"key", @[@5, @3.14, @100]);
let insiderExampleProduct = Insider.createNewProduct(
    withID: "product_id",
    name: "product_name",
    taxonomy: ["taxonomy_1", "taxonomy_2"],
    imageURL: "https://useinsider.com/image_url",
    price: 123.45,
    currency: "USD"
)

insiderExampleProduct?.setCustomAttributeWithNumericArray()("key", [5, 3.14, 10])