# Overview  
Attribution refers to the practice of identifying and attributing the influence of advertising on consumer behavior and purchasing decisions. In the digital advertising landscape, attribution plays a crucial role in understanding the impact and effectiveness of sponsored or promoted products and other ad formats in driving sales and revenue for businesses.

With Kevel, you can attribute any ad format to retail transactions—not just product listing ads (PLAs)—by defining a set of attributable products, categories, and brands associated with an ad. For PLAs this is set automatically based on the product metadata when using the “create ads from products” workflow in the UI or API via pre-defined Ad Template mappings. For display ads, sponsored brands and other formats, the set of attributable sales is explicitly set to match advertiser goals from specific product collection promotions to more general brand awareness campaigns.

There are four components to a successful attribution setup. These are outlined here with more details for each on the remainder of this page:

1. **Catalog setup**  
   - Product feed synced with Kevel. Catalog data is used when processing purchase events to determine the category and brand associated with the purchased product ID. Product data also enables an enhanced UI experience during the campaign setup step and enriches product-based reports.

2. **Campaign setup**  
   - A Campaign with at least one Flight that has Attribution Settings configured for post-click and/or post-view lookback window and product match.
   - One or more Ads in the Flight with Attributable Items set. For PLAs this is set automatically using the Ad Template selected in the Create Ads from Products workflow. For non-PLAs this is set on a per-ad basis.

3. **Ad impressions and clicks**  
   - Ad interaction events associated with an end user. When a user sees or clicks on an attribution-enabled Ad, a touchpoint is recorded.

4. **Purchase event stream**  
   - Ongoing stream of transaction data sent to Kevel's purchase event endpoint. When purchase events are received, Kevel looks for touchpoints for the same user that made the purchase.

# Catalog Setup  
To support attribution processing, product feeds must contain the following fields on each item. Exact names may vary and will be mapped to aliases as part of the Kevel Catalog setup process:
- Main Category ID  
  The ID of the leaf category this item belongs to. This is used for "same category" matches by Kevel's Attribution model.
- Main Category Name  
- Brand ID  
- Brand Name  
- Product Name  
- Product ID  
  The ID of items that should be used for "same product" matches by Kevel's Attribution model. This could be the primary key or a non-unique ID (e.g. UPC).
- Merchant ID  [optional]  
  Required for marketplaces where multiple merchants sell the same product.
- Merchant Name  [optional]

# Campaign Setup  
Attribution settings are configured on Flights and Ads:
- **Flight**  
  - Post-Click and Post-View Lookback Windows  
  - Post-Click and Post-View Match Types  
  - Attributable Items — optional.
- **Ad**  
  - Attributable Items — one or more product, category, or brand that, when purchased, can be attributed to this Ad.

## Lookback Windows  
A lookback window refers to a specific time period during which user interactions with sponsored product ads are attributed to conversions or actions. It determines how far back in time advertisers track and attribute conversions to their ad campaigns. Kevel supports both view-through and click-through attribution:
- **View-through attribution:** This match type attributes conversions to users who view a sponsored product ad but do not click on it.
- **Click-through attribution:** In this match type, conversions are attributed when a user clicks on a sponsored product ad and directly completes the desired action.

Kevel supports lookback windows of 1, 7, 14 and 30 days. Alternatively, you can select ‘none’ to not perform a specific kind of attribution.

## Attribution Match Types  
Attribution match types define the criteria used to match user interactions with sponsored product ads to conversions or actions.

### Same Product Attribution  
Same product attribution focuses on attributing conversions specifically to the exact product that was advertised.

### Same Brand and Category Attribution  
Same brand and category attribution expands the scope of attribution beyond the exact product to include other products within the same brand and category.

### Same Brand Attribution  
Same brand attribution takes a broader approach by attributing conversions to the overall brand rather than specific products or categories.

### Merchant-Aware Attribution  
The following additional options are available to marketplace customers:
#### Same Merchant Attribution  
The broadest possible match between an ad and a purchased product.
#### Require Merchant Match  
Enforces that for each product match level, the purchased product merchant must match the attribution criteria on the ad.

The choice of attribution model depends on the goals and objectives of advertisers. Different attribution models can be used to understand the impact of advertising on consumer behavior and conversions.

## Attributable Items  
For each attribution-enabled Ad, a set of "attributable items" must be defined. This is configured in the Management API on the Ad entity via the `AttributionSettings` field. This is an object that has a single key `AttributableItems`, an array of objects with the structure shown in the table below. Each object must have a `MatchType` key and one or more additional keys depending on the `MatchType` value.

| Attribute | Description |
| --- | --- |
| `MatchType` | One of `SameProduct`, `SameCategoryBrand`, `SameBrand`, or `SameMerchant`.
| `ProductId` | The Product ID to use with the match. Use with `"MatchType": "SameProduct"` only.
| `MerchantId` | The Merchant ID to use with the match. 
| `CategoryId` | The Category ID to use with the match. Use with `"MatchType": "SameCategoryBrand"` only.
| `BrandId` | The Brand ID to use with the match.

### Limits, validation, and other considerations  
A maximum of 30 attributable items across all match types can be added to a single Ad. A minimum of 1 attributable item of any match type must be included when setting `AttributableItems`.

### Purchase Event Stream  
In order to log purchase data with Kevel, send a server-side event for each purchase completed.
You will send a GET request to a network-specific endpoint. The following parameters are required for any attribution set up:
- `userKey` 
- `timestamp` 
- `quantity`
- `price`

A sample purchase event fully constructed: `https://e-123.adzerk.net/c/123/purchase?userKey=marketplaceshopper-456-abc&transactionId=1234567&timestamp=2022-11-02T16%3A27%3A20.974Z&productId=11982758&quantity=1&price=200&merchantId=12478&ltvQuantity=6&ltvValue=1200`

It is important to send a consistent UserKey in both the Ad Decision and the Purchase event request so that Kevel is able to perform a look back to determine whether the purchase can be attributable to an ad view or click.

### A single impression or click can be attributed to multiple purchases  
Touchpoints are **not consumed** when a purchase is attributed to them. A recorded impression or click remains eligible for attribution for the entire duration of its lookback window.

> 📘  
### Acceptable Delay in Sending Purchase Events  
Kevel accepts purchase events for up to 15 days after the lookback window has closed.

## End-to-End Testing Steps  
1. Create a Campaign with at least one Flight that has Attribution Settings configured for post-click and/or post-view lookback window and product match.
2. Create one or more Ads in the Flight from step 1 with Attributable Items set.
3. Make an ad decision request that returns the Ad(s) from step 2. Ensure this request includes a user key.
4. Trigger an impression for the Ad using the event URL returned in step 3.
5. Trigger a click event for the Ad using the event URL returned in step 3.
6. Send transaction data to the purchase event endpoint.

### What’s Next  
- [Attribution Reporting FAQ](https://dev.kevel.com/docs/attribution-faq)
