An event that describes the action of customizing a product.

Here's an example of a *Product Customization*:

- JavaScript
- Swift
- Kotlin

```javascript
pcdp("event", "track", {

"clientId": "kevel",

"siteId": "kevel.com",

"type": "productCustomization",

"customFields": {

"debug": "true",

"role": "superuser"

},

"product": {

"itemGroupId": "p125",

"name": "My product",

"brand": "Nike",

"category": "Men/Shirts/Short Sleeve Shirts",

"categoriesList": [

"Men",

"Shirts",

"Short Sleeve Shirts"

],

"secondaryCategory": "Men/Collections/Summer Essentials/Short Sleeve Shirts",

"secondaryCategoriesList": [

"Men",

"Collections",

"Summer Essentials",

"Short Sleeve Shirts"

],

"currency": "EUR",

"promotions": [

"WINTERSALE"

],

"adult": false,

"size": "S",

"sizeSystem": "EU",

"customFields": {

"color": "blue"

},

"id": "p125zc",

"price": 102.5,

"quantity": 1,

"discount": {

"value": 5,

"currency": "EUR"

},

"gender": "male",

"sku": "p125zc-5"

},

"productCustomizations": [

"set fabric to linen"

]

})
```

```swift
import Foundation

let event = """{

"clientId": "kevel",

"siteId": "kevel.com",

"type": "productCustomization",

"customFields": {

"debug": "true",

"role": "superuser"

},

"product": {

"itemGroupId": "p125",

"name": "My product",

"brand": "Nike",

"category": "Men/Shirts/Short Sleeve Shirts",

"categoriesList": [

"Men",

"Shirts",

"Short Sleeve Shirts"

],

"secondaryCategory": "Men/Collections/Summer Essentials/Short Sleeve Shirts",

"secondaryCategoriesList": [

"Men",

"Collections",

"Summer Essentials",

"Short Sleeve Shirts"

],

"currency": "EUR",

"promotions": [

"WINTERSALE"

],

"adult": false,

"size": "S",

"sizeSystem": "EU",

"customFields": {

"color": "blue"

},

"id": "p125zc",

"price": 102.5,

"quantity": 1,

"discount": {

"value": 5,

"currency": "EUR"

},

"gender": "male",

"sku": "p125zc-5"

},

"productCustomizations": [

"set fabric to linen"

]

}"""

let trackUrl = "https://tr.cdp.\(websiteDomain)/events"

var urlComponents = URLComponents(string: trackUrl)!

urlComponents.queryItems = [

URLQueryItem(name: "id_\(idType)", value: id),

URLQueryItem(name: "cookies", value: "false")

]

var request = URLRequest(url: urlComponents.url!)

request.httpMethod = "POST"

request.setValue("application/json", forHTTPHeaderField: "Content-Type")

request.setValue(userAgent, forHTTPHeaderField: "User-Agent")

request.httpBody = event.data(using: .utf8)!

URLSession.shared.dataTask(with: request).resume()
```

```kotlin
import androidx.core.net.toUri

import org.json.JSONObject

import java.net.URL

import javax.net.ssl.HttpsURLConnection

val event = """{

"clientId": "kevel",

"siteId": "kevel.com",

"type": "productCustomization",

"customFields": {

"debug": "true",

"role": "superuser"

},

"product": {

"itemGroupId": "p125",

"name": "My product",

"brand": "Nike",

"category": "Men/Shirts/Short Sleeve Shirts",

"categoriesList": [

"Men",

"Shirts",

"Short Sleeve Shirts"

],

"secondaryCategory": "Men/Collections/Summer Essentials/Short Sleeve Shirts",

"secondaryCategoriesList": [

"Men",

"Collections",

"Summer Essentials",

"Short Sleeve Shirts"

],

"currency": "EUR",

"promotions": [

"WINTERSALE"

],

"adult": false,

"size": "S",

"sizeSystem": "EU",

"customFields": {

"color": "blue"

},

"id": "p125zc",

"price": 102.5,

"quantity": 1,

"discount": {

"value": 5,

"currency": "EUR"

},

"gender": "male",

"sku": "p125zc-5"

},

"productCustomizations": [

"set fabric to linen"

]

}"

val trackUri = "https://tr.cdp.$websiteDomain/events".toUri().buildUpon()

.appendQueryParameter("id_$idType", id)

.appendQueryParameter("cookies", "false")

// Network requests aren't allowed in main thread. Get adequate scope from context.

// See https://kotlinlang.org/docs/coroutines-guide.html for more info.

coroutineScope.launch(Dispatchers.IO) {

val conn = (URL(trackUri.toString()).openConnection() as HttpsURLConnection).apply {

requestMethod = "POST"

setRequestProperty("User-Agent", userAgent)

setRequestProperty("Content-Type", "application/json")

doOutput = true

}

conn.outputStream.use { os ->

os.write(event.toByteArray(Charsets.UTF_8))

}

try {

// Trigger the request

conn.responseCode

} finally {

conn.disconnect()

}

}
```

In more detail, the fields supported on every *Product Customization* are:

| Field | Required | Type | Default | Example | Description |
| --- | --- | --- | --- | --- | --- |
| `clientId` |  | string |  | `"kevel"` | The client identifier. |
| `siteId` |  | string |  | `"kevel.com"` | The client's site identifier. |
| `type` | _required_ | `"productCustomization"` |  | `"productCustomization"` | The event type. |
| `customFields` |  | object of string |  | `{...}` | An object with custom fields for extra metadata to be supplied in the event. The values within this object must all be strings. |
| `facebookConversionTracking` |  | [Facebook Conversion Tracking Details](https://docs.audience.kevel.com/collect/events/productCustomization#facebook-conversion-tracking-details) |  | `[...](https://docs.audience.kevel.com/collect/events/productCustomization#facebook-conversion-tracking-details)` | A description of a tracking event to send to Facebook using Facebook Conversions API. |
| `product` | _required_ | [Product](https://docs.audience.kevel.com/collect/events/productCustomization#product) |  | `[...](https://docs.audience.kevel.com/collect/events/productCustomization#product)` | The product being customized. |
| `productCustomizations` | _required_ | array of string |  | `[...]` | An array of textual representation of the applied customizations. |

### Facebook Conversion Tracking Details

A description of a tracking event to send to Facebook using Facebook Conversions API.

| Field | Required | Type | Default | Example | Description |
| --- | --- | --- | --- | --- | --- |
| `pixel_id` |  | string |  | `"396622227884531"` | The pixel ID to associate this Facebook tracking event with. |
| `event_id` |  | string |  | `"0c53d0b57"` | ID used to deduplicate events sent by both Facebook Pixel and Conversions API. More information about the usefulness of this ID is available at [https://developers.facebook.com/docs/marketing-api/server-side-api/using-the-api/deduplicate-pixel-and-server-side-events](https://developers.facebook.com/docs/marketing-api/server-side-api/using-the-api/deduplicate-pixel-and-server-side-events). |
| `event_name` |  | string |  | `"AddToCart"` | A Facebook pixel Standard Event or Custom Event name. This field is used to deduplicate events sent by both Facebook Pixel and Conversions API. The available Standard Events are listed in [https://developers.facebook.com/docs/facebook-pixel/reference#standard-events](https://developers.facebook.com/docs/facebook-pixel/reference#standard-events). |
| `custom_data` |  | object |  | `{...}` | Parameters to send additional data Facebook can use for ads delivery optimization. More information about the fields that can be supplied here is available at [https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/custom-data](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/custom-data). |

### Product

The product being customized.

| Field | Required | Type | Default | Example | Description |
| --- | --- | --- | --- | --- | --- |
| `itemGroupId` |  | string |  | `"p125"` | Identifier for a group of products that come in different versions (variants). |
| `name` |  | string | `""` | `"My product"` | Product name. |
| `brand` |  | string |  | `"Nike"` | Product brand. |
| `category` |  | string |  | `"Men/Shirts/Short Sleeve Shirts"` | Product category. If possible, 'categoriesList' should be filled instead of this field. |
| `categoriesList` |  | array of string |  | `[
      "Men",
      "Shirts",
      "Short Sleeve Shirts"
    ]` | A hierarchically sorted list of the sub-categories that this product belongs to. The first item on this list should be the most general sub-category, while the last should be the most specific. Any item on this list should correspond to a sub-category of the item immediately preceding it. If 'category' is present and this field is left undefined, the default value of this field will be a best effort derivation of 'category'. Typically used to represent the **canonical category** of products. |
| `secondaryCategory` |  | string |  | `"Men/Collections/Summer Essentials/Short Sleeve Shirts"` | Secondary Product category. If possible, 'secondaryCategoriesList' should be filled instead of this field. |
| `secondaryCategoriesList` |  | array of string |  | `[...]` | A hierarchically sorted list of the secondary sub-categories that this product belongs to. The first item on this list should be the most general sub-category, while the last should be the most specific. Any item on this list should correspond to a sub-category of the item immediately preceding it. If 'secondaryCategory' is present and this field is left undefined, the default value of this field will be a best effort derivation of 'secondaryCategory'. Typically used to represent the **navigational category** of products. |
| `currency` | _required_ | string |  | `"EUR"` | The currency used in monetary values. Supported values: `"PLN"`, `"CAD"`, `"HKD"`, `"AUD"`, `"SEK"`, `"TRY"`, `"BRL"`, `"KRW"`, `"CZK"`, `"BGN"`, `"ETH"`, `"CLP"`, `"GBP"`, `"MXN"`, `"THB"`, `"ISK"`, `"SGD"`, `"CHF"`, `"INR"`, `"LTC"`, `"CNY"`, `"PHP"`, `"RON"`, `"BTC"`, `"DKK"`, `"XAU"`, `"XAG"`, `"JPY"`, `"ARS"`, `"HUF"`, `"MYR"`, `"USD"`, `"RUB"`, `"NZD"`, `"IDR"`, `"ILS"`, `"NOK"`, `"NAD"`, `"EUR"`, `"ZAR"` and `"HRK"`. |
| `promotions` |  | array of string | `[]` | `[
      "WINTERSALE"
    ]` | Vouchers applied in the purchase or displayed together with the product. |
| `adult` |  | boolean | `false` | `false` | Whether the product includes adult content (alcohol, guns, gambling, sexually suggestive content...) and might not show up to some users. |
| `size` |  | string |  | `"S"` | Product size. |
| `sizeSystem` |  | string |  | `"EU"` | Country of the size system used by your product. |
| `customFields` |  | object of string |  | `{"color": "blue"}` | Additional fields related to the product. The values within this object must all be strings. |
| `id` | _required_ | string |  | `"p125zc"` | Product identifier. |
| `price` |  | number | `0` | `102.5` | The product's price. |
| `quantity` |  | number | `1` | `1` | Number of items purchased. |
| `discount` |  | [Discount](https://docs.audience.kevel.com/collect/events/productCustomization#discount) |  | `[...](https://docs.audience.kevel.com/collect/events/productCustomization#discount)` | Discount applied to the product. |
| `gender` |  | string |  | `"male"` | Gender for which the product is intended. |
| `sku` |  | string |  | `"p125zc-5"` | Product SKU. |

### Discount

Discount applied to the product. One of [Percentage Discount](https://docs.audience.kevel.com/collect/events/productCustomization#percentage-discount), [Price Discount](https://docs.audience.kevel.com/collect/events/productCustomization#price-discount) or [Value Discount](https://docs.audience.kevel.com/collect/events/productCustomization#value-discount).

#### Percentage Discount

A discount description where the percentage discounted is provided.

| Field | Required | Type | Default | Example | Description |
| --- | --- | --- | --- | --- | --- |
| `percentage` | _required_ | number |  | `0.25` | The percentage of the discount. |

#### Price Discount

A discount description where the price after the discount is provided.

| Field | Required | Type | Default | Example | Description |
| --- | --- | --- | --- | --- | --- |
| `price` | _required_ | number |  | `42` | The price after the discount. |
| `currency` | _required_ | string |  | `"EUR"` | The currency used in monetary values. Supported values: `"PLN"`, `"CAD"`, `"HKD"`, `"AUD"`, `"SEK"`, `"TRY"`, `"BRL"`, `"KRW"`, `"CZK"`, `"BGN"`, `"ETH"`, `"CLP"`, `"GBP"`, `"MXN"`, `"THB"`, `"ISK"`, `"SGD"`, `"CHF"`, `"INR"`, `"LTC"`, `"CNY"`, `"PHP"`, `"RON"`, `"BTC"`, `"DKK"`, `"XAU"`, `"XAG"`, `"JPY"`, `"ARS"`, `"HUF"`, `"MYR"`, `"USD"`, `"RUB"`, `"NZD"`, `"IDR"`, `"ILS"`, `"NOK"`, `"NAD"`, `"EUR"`, `"ZAR"` and `"HRK"`. |

#### Value Discount

A discount description where the value of the discount is provided.

| Field | Required | Type | Default | Example | Description |
| --- | --- | --- | --- | --- | --- |
| `value` | _required_ | number |  | `10` | The total value of the discount. |
| `currency` | _required_ | string |  | `"EUR"` | The currency used in monetary values. Supported values: `"PLN"`, `"CAD"`, `"HKD"`, `"AUD"`, `"SEK"`, `"TRY"`, `"BRL"`, `"KRW"`, `"CZK"`, `"BGN"`, `"ETH"`, `"CLP"`, `"GBP"`, `"MXN"`, `"THB"`, `"ISK"`, `"SGD"`, `"CHF"`, `"INR"`, `"LTC"`, `"CNY"`, `"PHP"`, `"RON"`, `"BTC"`, `"DKK"`, `"XAU"`, `"XAG"`, `"JPY"`, `"ARS"`, `"HUF"`, `"MYR"`, `"USD"`, `"RUB"`, `"NZD"`, `"IDR"`, `"ILS"`, `"NOK"`, `"NAD"`, `"EUR"`, `"ZAR"` and `"HRK"`. |
