Traffic source (order attribution)¶
An order can store the marketing traffic source that led to the booking, also called the order attribution. It answers the question "where did this customer come from?": the website or platform that sent the visitor, the marketing channel, the campaign and the specific ad. Partners can use it to measure the performance of their marketing activities, for example to compare newsletter, paid search and social media campaigns.
The traffic source is optional. It is stored on the order as additional information and has no influence on prices, offers, validation or fulfillment of the order.
Data model¶
The traffic source is sent and stored in the attribution property of the order.
| Property | Type | Description | Typical source |
|---|---|---|---|
source |
string | Who sent the traffic, e.g. google, newsletter, partner-website |
utm_source |
medium |
string | The marketing channel, e.g. cpc, email, social |
utm_medium |
campaign |
string | The campaign name, e.g. summer-sale |
utm_campaign |
adId |
string | The id of a specific ad. For Google and Meta this is the click id: gclid (source Google) or fbclid (source Meta) |
utm_id, gclid, fbclid |
additionalParameters |
object | Any further custom key/value pairs (string values), e.g. an attribute you want to pass on to your CRM. Click ids (gclid, fbclid) are not stored here, use adId |
All properties are optional. The values are free text; discover.swiss does not restrict them to a predefined list.
Setting the traffic source on an order¶
The traffic source is part of the order request of the B2C and the B2B marketplace (POST /orders and PUT /orders/{orderNumber}).
{
"orderStatus": "New",
"priceCurrency": "CHF",
"attribution": {
"source": "google",
"medium": "cpc",
"campaign": "summer-sale",
"adId": "1234567890",
"additionalParameters": {
"myCrmParam": "my attribute value to pass on to CRM"
}
}
}
Request examples:
- B2C: Create order
- B2B: Create order
Behavior on create and update:
- The traffic source is usually set once, when the order is created.
- An order update (
PUT) withattributionreplaces the stored traffic source as a whole. Properties that are not part of the newattributionobject are not kept. - An order update without
attribution(or withattribution: null) keeps the stored traffic source. A stored traffic source cannot be removed with an order update.
Note
The traffic source is not returned in the order response of the marketplace API. It is available to partners through the channels listed below.
Where the traffic source is available¶
- Profile notifications: order notifications contain the traffic source of the order. See Profile notifications.
- Partner portal: the order search can be filtered and faceted by traffic source (
trafficSource, which contains thesourcevalue), and the order details contain the full traffic source (attribution).
Checkout web component¶
The checkout web component (checkout-core) detects the traffic source automatically from the query string of the page
(utm_source, utm_medium, utm_campaign, utm_id, gclid, fbclid, ...) and sends it with the order.
The host website can also set the traffic source explicitly in the component configuration.
See Checkout component - Traffic source.