Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Product View

Method Objective

Status
colourYellow
titlerequired
 The method gives the system an understanding of the product viewed by the user.

Syntax and parameters

Code Block
languagejava
themeFadeToGrey
Params view = new Params();
view
    .put(new Params.Item(product_id))
    .put(new Params.RecommendedBy(Params.RecommendedBy.TYPE.RECOMMENDATION, recommeder_code));
PersonaClick.track(Params.TrackEvent.VIEW, view);

NameTypeRequirementDescription
product_idstringrequiredThe ID of the current product
recommender_codestringrequired is some casesThis property should have a unique code for the product recommendations block if the current product was opened from the recommendation block. The unique code is available in the PersonaClick account in the "data-recommender-code" attribute of each block.

Example of use

Code Block
languagejava
themeFadeToGrey
Params view = new Params();
view
    .put(new Params.Item("100500"))
    .put(new Params.RecommendedBy(Params.RecommendedBy.TYPE.RECOMMENDATION, "b934b6ba2eb6202b8922d6a3fb8b3271"));
PersonaClick.track(Params.TrackEvent.VIEW, view);



Category View

Method Objective

Status
colourYellow
titlerequired
 The method gives the system an understanding of the category viewed by the user.

Warning

The API will respond with an error for categories unknown to the system. The system only knows the categories from the product feed (XML) or the HTTP import of the category list.

Syntax and parameters

Code Block
languagejava
themeFadeToGrey
PersonaClick.track(Params.TrackEvent.CATEGORY, (new Params()).put(Params.Parameter.CATEGORY_ID, category_id));

NameTypeRequirementDescription
category_idstringrequiredThe ID of the current category.

Example of use

Code Block
languagejava
themeFadeToGrey
PersonaClick.track(Params.TrackEvent.CATEGORY, (new Params()).put(Params.Parameter.CATEGORY_ID, "146"));



Adding a product to the cart

Method Objective

Status
colourYellow
titlerequired
 The method gives the system an understanding of the product added to the cart by the user.

Syntax and parameters

Code Block
languagejava
themeFadeToGrey
Params cart = new Params();
cart
	.put(new Params.Item(product_id)
		.set(Params.Item.COLUMN.FASHION_SIZE, fashion_size)
		.set(Params.Item.COLUMN.AMOUNT, amount)
	)
	.put(new Params.RecommendedBy(Params.RecommendedBy.TYPE.RECOMMENDATION, recommender_code));
PersonaClick.track(Params.TrackEvent.CART, cart);

NameTypeRequirementDescription
product_idstringrequiredThe ID of the product added to the cart
amountstringoptionallyQuantity of product. Default: 1.
fashion_sizestringoptionallyThe parameter allows specifying the size of the product related to the Apparel & Accessories niche.
recommender_codestringrequired in some casesThis property should have a unique code for the product recommendations block if the current product was added to the cart from the recommendation block. The unique code is available in the PersonaClick account in the "data-recommender-code" attribute of each block.

Example of use

Code Block
languagejava
themeFadeToGrey
Params cart = new Params();
cart
	.put(new Params.Item("100500")
		.set(Params.Item.COLUMN.FASHION_SIZE, "M")
		.set(Params.Item.COLUMN.AMOUNT, 2)
	)
	.put(new Params.RecommendedBy(Params.RecommendedBy.TYPE.RECOMMENDATION, "b934b6ba2eb6202b8922d6a3fb8b3271"));
PersonaClick.track(Params.TrackEvent.CART, cart);



Removing a product from the cart

Method Objective

Status
colourYellow
titlerequired
 The method gives the system an understanding of the product removed from the cart by the user.

Syntax and parameters

Code Block
languageapplescriptjava
themeFadeToGrey
sdkPersonaClick.track(event: .productRemovedFromCart(id:Params.TrackEvent.REMOVE_FROM_CART, product_id)) { callback };

function
NameTypeRequirementDescription
product_idstringrequiredThe ID of the product removed from the cartcallbackoptionallyCallback function to catch success or error

Example of use

Code Block
languageapplescript
themeFadeToGrey
sdkPersonaClick.track(event: .productRemovedFromCart(id: "100500")) { trackResponse in
    print("Product removed from the cart callback")
    switch trackResponse {
        case let .success(response):
            print("Successful")
        case let .failure(error):
            switch error {
                case .custom(let customError):
                    print("Error: ", customError)
                default:
                    print("Error: ", error.localizedDescription)
            }
            fatalError("Task failed successfully")
    }
}

Update the current cart

Method Objective

The method updates the whole cart on the system side.

Tip

Use this method when the user, for example, changes the quantity of a product in the cart or completely purges the cart. Also, this method can be used as an alternative to the "Add to cart" and "Remove from cart" methods if you have access to the entire cart when these events occur for a specific product.

Syntax and parameters

Code Block
languageapplescript
themeFadeToGrey
sdk.track(event: .synchronizeCart(ids: product_ids)) { callback }
NameTypeRequirementDescriptionproduct_idsarrayrequiredThe ID of the product in the cartcallbackfunctionoptionallyCallback function to catch success or error

Example of use

Code Block
languageapplescript
themeFadeToGrey
sdk.track(event: .synchronizeCart(ids: ["146", "100500", "12345"])) { trackResponse in
    print("Cart synchronized callback")
    switch trackResponse {
        case let .success(response):
            print("Successful")
        case let .failure(error):
            switch error {
                case .custom(let customError):
                    print("Error: ", customError)
                default:
                    print("Error: ", error.localizedDescription)
            }
            fatalError("Task failed successfully")
    }
}Params.TrackEvent.REMOVE_FROM_CART, "100500");



Successful checkout

Method Objective

Status
colourYellow
titlerequired
 The method gives the system information about the successful checkout, its products, and other information related to the checkout.

Syntax and parameters

Code Block
languageapplescript
themeFadeToGrey
sdk.track(event: .orderCreated(orderId, totalValue, products)) { callback }Params purchase = new Params();
purchase
	.put(new Params.Item(product_id).set(Params.Item.COLUMN.AMOUNT, amount))
	.put(Params.Parameter.ORDER_ID, order_id)
	.put(Params.Parameter.ORDER_PRICE, order_price);
PersonaClick.track(Params.TrackEvent.PURCHASE, purchase);

Request parameters

NameTypeRequirementDescription
productsproduct_idarraystringrequiredAn array of purchased products. See the table below for details.orderIdProduct ID.
amountnumberrequiredProduct Quantity.
order_idstringoptionallyInternal store Order ID. If not specified, the system will create its internal ID. Synchronization of order statuses, in this case, won't be available.
totalValueorder_pricenumberoptionallyThe final order value, including all discounts. If not specified, the system will calculate the order value based on prices from the product feed.

Product properties:

NameTypeRequirementDiscriptionidstringrequiredProduct ID.amountnumberrequiredProduct Quantity.

Example of use

Code Block
languageapplescript
themeFadeToGrey
sdk.track(event: .orderCreated(orderId: "N100500", totalValue: 750, products: [(id: "37", amount: 3), (id: "187", amount: 1)])) { trackResponse in
    print("Order is created callback")
    switch trackResponse {
        case let .success(response):
            print("Successful")
        case let .failure(error):
            switch error {
                case .custom(let customError):
                    print("Error: ", customError)
                default:
                    print("Error: ", error.localizedDescription)
            }
            fatalError("Task failed successfully")
    }
}Params purchase = new Params();
purchase
	.put(new Params.Item("37").set(Params.Item.COLUMN.AMOUNT, 3))
	.put(new Params.Item("187").set(Params.Item.COLUMN.AMOUNT, 1))
	.put(Params.Parameter.ORDER_ID, "N100500")
	.put(Params.Parameter.ORDER_PRICE, 750);
PersonaClick.track(Params.TrackEvent.PURCHASE, purchase);



Adding a product to the wishlist

Method Objective

The method gives the system an understanding the user has added a product to the wishlist.

Syntax and parameters

Code Block
languageapplescript
themeFadeToGrey
sdkPersonaClick.track(event: .productAddedToFavorities(id:Params.TrackEvent.WISH, product_id)) { callback };

NameTypeRequirementDescription
product_idstringrequiredThe ID of the product added to the wishlistcallbackfunctionoptionallyCallback function to catch success or error

Example of use

Code Block
languageapplescript
themeFadeToGrey
sdkPersonaClick.track(event: .productAddedToFavorities(id: "100500")) { trackResponse in
    print("Product added to the wishlist callback")
    switch trackResponse {
        case let .success(response):
            print("Successful")
        case let .failure(error):
            switch error {
                case .custom(let customError):
                    print("Error: ", customError)
                default:
                    print("Error: ", error.localizedDescription)
            }
            fatalError("Task failed successfully")
    }
}Params.TrackEvent.WISH, "100500");



Removing a product from the wishlist

Method Objective

The method gives the system an understanding the user has removed a product from the wishlist.

Syntax and parameters

Code Block
languageapplescript
themeFadeToGrey
sdkPersonaClick.track(event: .productRemovedToFavorities(id:Params.TrackEvent.REMOVE_FROM_WISH, product_id)) { callback };

NameTypeRequirementDescription
product_idstringrequiredThe ID of the product removed from the wishlistcallbackfunctionoptionallyCallback function to catch success or error

Example of use

Code Block
languageapplescript
themeFadeToGrey
sdkPersonaClick.track(event: .productRemovedToFavorities(id: "100500")) { trackResponse in
    print("Product removed from the wishlist callback")
    switch trackResponse {
        case let .success(response):
            print("Successful")
        case let .failure(error):
            switch error {
                case .custom(let customError):
                    print("Error: ", customError)
                default:
                    print("Error: ", error.localizedDescription)
            }
            fatalError("Task failed successfully")
    }
}Params.TrackEvent.REMOVE_FROM_WISH, "100500");


Custom event

Method Objective

The method gives the system an understanding that some user event has happened.

Note

Before you can use custom events, you must create them in the PersonaClick account: Settings > Custom events.

Syntax and parameters

Code Block
languageapplescript
themeFadeToGrey
sdkPersonaClick.trackEventtrack(event: custom_event_key, category, label, value);


NameTypeRequirementDescription
custom_event_keystringrequiredUnique custom event key. Must be pre-created in the PersonaClick account: Settings > Custom events.
categorystringoptionallyA category is a name that you supply as a way to group some event's properties.
labelstringoptionallyWith labels, you can provide additional information for events that you need.
valuenumberoptionallyThe value property can be any integer and can be used to send a specific value in an event.

Examples of use

Code Block
languageapplescript
themeFadeToGrey
sdkPersonaClick.trackEventtrack(event: "my_event");

Code Block
languageapplescript
themeFadeToGrey
sdkREES46.trackEventtrack(event: "my_event", category: "my_category", label: "my_label", value: 100500);


Source Tracking

Method Objective

The method gives the system an understanding that the user jumped from the campaign message: bulk, chain, transactional.

Syntax and parameters

Code Block
languageapplescript
themeFadeToGrey
sdk.trackSource(source, code)

NameTypeRequirementDescription
sourceenum stringrequired

One of the string enum values. Available values:

  • .bulk
  • .chain
  • .transactional
Tip

The "src.type" value in the "payload" of the campaign should be used to define the value for this parameter. See Payload Examples.


codestringrequired

Unique campaign code

Tip

The "src.id" value in the "payload" of the campaign should be used to define the value for this parameter. See Payload Examples.


Example of use

Code Block
languageapplescript
themeFadeToGrey
sdk.trackSource(source: .chain, code: "100500146")


Table of Contents
maxLevel2
minLevel2
styledics
classpersonaclick-fixed-position
printablefalse