Documentation Index

Fetch the complete documentation index at: https://help.yahooinc.com/llms.txt

Use this file to discover all available pages before exploring further.

Transaction Data Delivery Through Browser to Server

Prev Next

Online transaction data, including product codes for individual transactions, can be sent using your existing pixel credentials through the Browser to Server method as follows.

  1. Place the Javascript Dot tag, which is linked to the default pixel ID you chose, on your product website (refer to example below).

    <script>(function(w,d,t,r){var q=[];w.ypr=function(e,t,d){q.push({e:e,t:t,d:d})};var s=d.createElement(t);s.src=r;s.async=!0;s.onload=s.onreadystatechange=function(){var y,rs=this.readyState;if(rs&&rs!="complete"&&rs!="loaded"){return};try{w.ypr=function(e,t,d){d.pixelId=<pixel_id_value_here>;YAHOO.ywa.I13N.firePostBeacon(e,t,d)};for(var n=0;n<q.length;n++){var o=q[n];w.ypr(o.e,o.t,o.d)};q=[]}catch(e){}};var scr=d.getElementsByTagName(t)[0],par=scr.parentNode;par.insertBefore(s,scr)})(window,document,"script","https://s.yimg.com/wi/ytc.js")</script>

    Important

    • If it is desired to use an existing online conversion pixel or IFO pixel as the default pixel, leave the existing code on the page and append the new pixel code from the IFO rule list page. Both the existing and new codes can coexist on the same page, but only one instance of the new code should be present.

    • If the default pixel needs to be changed at any time, contact your Yahoo Account team to update the default pixel assignment. Once the default pixel is changed, replace the existing default pixel code on your product website with the new code pointing to the new default pixel ID.

    • The default pixel can have multiple rules attached to it and the code for the default pixel only needs to be implemented once on your product website, provided the default pixel does not change.

  2. Make a call to the Javascript tag with transaction events (refer to example below). For more details on what fields are required for the call, refer to Required and Supported Fields.

    <!-- retailer's code -->
    <script>
    var config = {
    pageUrl: 'https://example.com',
    userData: {
    ids: {
    EMAIL: ['hashed_value'],
    PHONE: ['hashed_value'],
    },
    },
    eventData: {
    totalPrice: 123.45,
    currency: "usd",
    products: [
    {
    id: "12345SKU", // unique id for product / service
    unitPrice: 123.45,
    quantity: 1, // count of product in transaction
    customKeyValues: {
    custom: "value",
    key: "hole"
    }
    }
    ],
    customKeyValues: {
    key: 'value',
    }
    }
    };
    function fireBeacon() {
    window.ypr('collect', 'purchase', config);
    }
    </script>

Required and supported fields

The required fields for a successful call are described in the table below.

Field

Type

Required/Optional

Description

pageUrl

String

Required

The URL of the page.

country

String

Optional

The alpha-2 country code.

userData

Object

Required

The wrapper object for all user data.

userData.ids

Map<String, List<String>>

Required

The ID type to list of ids for that type. Supported keys (types) include:

  • IDFA (iOS advertising id)

  • GPSAID (Android advertising id)

  • DEVICE_ID (Generic device identifier)

  • EMAIL (value MUST be sha256 hashed. Email addresses should be lowercased prior to hashing and resulting hash value should also be lowercase).

  • PHONE (value MUST be sha256 hashed)

  • PXID (value is a combination of <provider source id>:<provider id>)

    • Provider source ID will be provided by Yahoo to the advertiser.

For example,

userData: {

ids: {

"IDFA": ["082a1d3e-954b-4e84-8bbd-516c20e7d0ad"],

"EMAIL":["4d0d74c86081eff9c3f51536dc82f0a7ab1824fb01954ae9d9516cfc36e8dc43"],

"PXID":["42:4c86081eff9c3f51"]

}

}

eventData

Object

Required

The wrapper object for all event data.

eventData.totalPrice

Number

Optional

The total price of the entire purchase.

eventData.currency

String

Optional

The currency code for purchase (“USD” for example).

products

List<Product>

Required

The list of all the Product objects involved in the event, such as a purchase.

For example,

products: [

{

productId: "Yod/pur",

unitPrice: 25.99,

quantity: 2,

customKeyValues: {

"BRAND": "Yahoo",

"PRODUCT_NAME": "Yodel button purple"

}

}

]

product

Object

Required

The wrapper object for product details.

product.id

String

Required

The unique id for the product, such as SKU.

product.quantity

Integer

Optional

The number of units for the product.

product.unitPrice

Number

Required

The price per individual product unit.

product.customKeyValues

Map<String, String>

Optional

Product level custom key value map.

eventData.customKeyValues

Map<String, String>

Optional

A map of custom keys and values.

Supported keys currently include:

  • BRAND

  • PRODUCT_NAME

For example,

customKeyValues: {

"BRAND": "Yahoo",

"PRODUCT_NAME": "Yodel button purple"

}

Note

Yahoo DSP supports up to four (4) customKeyValues via CAPI. These values represent custom reporting dimensions.