iOS Mobile SDK: Notify Product Visit Event

The “Notify Product Visit Event” is used to communicate that the contact has visited a specific product during their navigation in the app. It notifies via Mobile SDK when a user accesses a product detail page using the Connectif.sendProductVisit() method.

 

How to use it

The product visit notification uses the Product object from the sendProductVisit method to enrich the information of the events sent.

Notify the Visited Product Information

These are the properties we can send in our Product object:

Name Required Type Description
productDetailUrl Yes String Product page URL (the URL must be unencoded).
productId Yes String Unique product identifier (in the eCommerce).
name Yes String Product name.
description No String Product description. It can contain HTML code.
imageUrl No String Product image URL.
unitPrice Yes Decimal Product unit price.
availability No Availability Can have one of the following values: .inStock or .outOfStock.
categories No List<String> The category the product belongs to. If the eCommerce allows subcategories, you can specify them with the full category path, separating each level with a '/' character.
For example: "/Computers/Keyboards/Logitech".
tags No List<String> Tags associated with the product.
brand No String Product brand.
reviewCount No Int Number of reviews for the product.
rating No Int Product rating normalized to a 0-5 range.
ratingCount No Int Number of product ratings.
thumbnailUrl No String Product thumbnail image URL.
relatedExternalProductIds No List<String> IDs of related products.
priority No Int Product priority.
unitPriceOriginal No Decimal Original unit price of the product.
unitPriceWithoutVAT No Decimal Product's original unit price without VAT.
discountedAmount No Decimal Discounted amount for the product.
discountedPercentage No Int Discount percentage, in the 0 to 100 range without the percentage symbol.
publishedAt No Date Date the product was published in the store's catalog.
customField1 No String Custom product field.
customField2 No String Custom product field.
customField3 No String Custom product field.

This type of event automatically collects the following information:

  • Operating system: Android or iOS.
  • App version.
  • Operating system version.
  • Connectif SDK version.

 

Example:

The notification will look like this.

let productBasketItem = ProductBasketItem(
    productDetailUrl: "https://example.com/product/12345",
    productId: "59a31949a1a562d4979fbca2",
    name: "Example Product",
    unitPrice: Decimal(51.88),
    description: "This is an example product",
    imageUrl: "https://example.com/product/images/12345.jpg",
    availability: Product.Availability.inStock,
    categories: ["Electronics", "Gadgets"],
    tags: ["Trending", "New Arrival"],
    brand: "ExampleBrand",
    reviewCount: 150,
    rating: Decimal(4.5),
    ratingCount: 124,
    thumbnailUrl: "https://example.com/product/thumbnails/12345.jpg",
    relatedExternalProductIds: ["54321", "67890"],
    priority: 10,
    unitPriceOriginal: Decimal(120.00),
    unitPriceWithoutVAT: Decimal(80.00),
    discountedAmount: Decimal(20.00),
    discountedPercentage: Decimal(16.67),
    publishedAt: Date(),
    customField1: "Special Edition",
    customField2: "Limited Stock",
    customField3: "Online Only",
    price: Decimal(51.88),
    quantity: 1
)

let purchase = Purchase(
    products: [productBasketItem],
    totalQuantity: 1,
    totalPrice: Decimal(51.88),
    cartId: "cart-0098caf9-42f4-44e9-afdd-45eafe892293",
    paymentMethod = "Credit Card",
    purchaseDate = Date(),
    purchaseId = "purchase-e3418b5a-8709-4593-a7c8-d8a7f12df737"
)

Connectif.sendPurchase(purchase)

 

 

Callbacks (Opcional)

Si queremos tener feedback de posibles errores al enviar eventos, podremos añadir un EventCallbacks cuando usemos nuestro método.

EventCallbacks(
    onSuccess: {
        // Manejo en caso de éxito
    },
    onError: { error in
        // Manejo en caso de error
    })
 

Congratulations!
You have reached the end of the lesson.

  

Do you still have unresolved questions?
Remember that our Connectif specialists are at your disposal. To contact them, simply open a support ticket by clicking the blue “Help” button on your dashboard.


Keep learning!

To make the most of your Connectif account, we recommend continuing with the following articles: