Triggering Page View Pixels - iOS
Make sure you have completed the steps mentioned in the main iOS Application Pixel Integration guide before going through this page.
Individual Page View Pixels are triggered on different screens of your app. Add the code snippet given below for each Pixel to where the screen’s logic is written, to trigger it on the relevant screen.
Import the discovery_ios_sdk
module on the files where you need to trigger pixels.
import discovery_ios_sdk
For detailed information on any of the Page View Pixels or where you should trigger it, refer to this guide.
Global Tracking Snippet
PixelTracker.shared.pageViewPixel(
ref: "http%3A%2F%2Fmerchantname.app%2Fcategory%2Fdresses",
title: "Blue%20Lace%20Dress"
)
Here is a list of the different parameters you can use to configure the pixel:
Parameter | Description |
---|---|
ref | Synthetic URL from referrer screen |
title | The screen name of the app view |
Product Page View Pixel
PixelTracker.shared.productPageViewPixel(
ref: "http%3A%2F%2Fmerchantname.app%2Fcategory%2Fdresses",
title: "Blue%20Lace%20Dress",
prodId: "prodId",
prodName: "prodName",
ku: "sku"
)
Here is a list of the different parameters you can use to configure the pixel:
Parameter | Description |
---|---|
ref | Synthetic URL from referrer screen |
title | Screen name of the app view |
prodId | This is the unique ID that identifies a product or product collection. This identifier should match the ID as specified in the product catalog feed |
prodName | The name of the product being viewed |
sku | Unique SKU ID that represents the selected variant of this product. If your site does not have SKUs, leave this blank |
Content Page View Pixel
var catalogs: [CatalogItem] = []
catalogs.append(CatalogItem(name: "cat1"))
PixelTracker.shared.contentPageViewPixel(
ref: "http%3A%2F%2Fmerchantname.app%2Fcategory%2Fdresses",
title: "Blue%20Lace%20Dress",
catalogs: catalogs,
itemId: "itemId",
itemName: "itemName"
)
Here is a list of the different parameters you can use to configure the pixel:
Parameter | Description |
---|---|
ref | Synthetic URL from referrer screen |
title | Screen name of the app view |
catalogs | List of CatalogItem objects that are shown on the screen. In case the screen has multiple tabs, only the catalogs of the selected (and visualized) tabs should be included. If multiple catalogs are shown in the active screen (or tab) all of them should be included. The CatalogItem object has the following parameters:name - Catalog Name viewIds - A unique ID for a specific view of your product catalog. View IDs are decided by Bloomreach and you at the time of integration. This can have Single or Multiple IDs. |
itemId | Unique ID of the item being shown on the screen. This identifier should match the item_id as specified in the content feed |
itemName | Name or Title of the content item |
Content Search Page View Pixel
var catalogs: [CatalogItem] = []
catalogs.append(CatalogItem(name: "cat1"))
PixelTracker.shared.contentSearchPageViewPixel(
ref: "http%3A%2F%2Fmerchantname.app%2Fcategory%2Fdresses",
title: "Blue%20Lace%20Dress",
catalogs: catalogs,
searchTerm: "test"
)
Here is a list of the different parameters you can use to configure the pixel:
Parameter | Description |
---|---|
ref | Synthetic URL from referrer screen |
title | Screen name of the app view |
catalogs | List of CatalogItem objects that are shown on the screen. In the case the screen has multiple tabs, only the catalogs of the selected (and visualized) tabs should be included. If multiple catalogs are shown on the active screen (or tab) all of them should be included. The CatalogItem object has the following parameters:name - Catalog Name viewIds - A unique ID for a specific view of your product catalog. View IDs are provided by Bloomreach and you at the time of integration. This can have Single or Multiple IDs. |
searchTerm | The value of the search query that was executed |
Category Page View Pixel
PixelTracker.shared.categoryPageViewPixel(
ref: "http%3A%2F%2Fmerchantname.app%2Fcategory%2Fdresses",
title: "Blue%20Lace%20Dress",
category: "catName",
categoryId: "catId"
)
Here is a list of the different parameters you can use to configure the pixel:
Parameter | Description |
---|---|
ref | Synthetic URL from referrer screen |
title | Screen name of the app view |
categoryId | Unique category ID as referred to in the catalog |
category | The full breadcrumb path of the category, separated by pipe (|). Value needs to match the crumb value in your feed. eg: If the Crumb path is “Home > Clothing > Outerwear”, you’ll enter "Home|Clothing|Outerwear" |
Search Result Page View Pixel
PixelTracker.shared.searchResultPageViewPixel(
ref: "http%3A%2F%2Fmerchantname.app%2Fcategory%2Fdresses",
title: "Blue%20Lace%20Dress",
searchTerm: "test"
)
Here is a list of the different parameters you can use to configure the pixel:
Parameter | Description |
---|---|
ref | Synthetic URL from referrer screen |
title | Screen name of the app view |
searchTerm | The value of the search query that was executed for this screen |
Conversion Page View Pixel
var basket:[PixelBasketItem] = []
basket.append( PixelBasketItem(prodId: "prodId1", name: "name1", sku: nil, quantity: "1", price: "12"))
PixelTracker.shared.conversionPageView(
ref: "http%3A%2F%2Fmerchantname.app%2Fcategory%2Fdresses",
title: "Blue%20Lace%20Dress",
isConversion: true,
basketValue: "$123",
orderId: "orderId",
basket: basket
)
Here is a list of the different parameters you can use to configure the pixel:
Parameter | Description |
---|---|
ref | Synthetic URL from referrer screen |
title | The Screen name of the app view |
isConversion | Set to true to indicate this is a Conversion screen or Order confirmation screen |
basketValue | The total price of the checkout basket including tax, discounts, shipping and/or discounts in the account currency |
orderId | The order ID associated with the order placed |
basket | List of the PixelBasketItem objects (Products purchased). The PixelBasketItem object has the following parameters:prodId - Product ID of the purchased product name - Name of the purchased product sku - SKU number of the purchased product quantity - Purchased quantity of the product price - Price for the product |
Updated 9 months ago