How to map SCHAIN in a mapping rule

This article is a step-by-step guide on how to create a mapping rule for SCHAIN property.

Step by step guide

It is possible to use the Mapping Rule feature (for an advertiser or an inventory) to add or update the "SCHAIN" property in the RTB request.

Gamoshi SCHAIN mapping rule setup

  1. In order to send a SCHAIN value to an Advertiser make sure that the 'Send Supply Chain' switch in the General Details tab of the Advertiser is activated.
  2. Be noted that when using a mapping rule to map a SCHAIN value it will override any value being transferred by the inventory partner.
  3. The SCHAIN 'To' property value in the mapping rule should be a serialized string enclosed within quotes (" "). If you are uploading a CSV file there is no need to use quotes.
  4. The SCHAIN 'To' value in the mapping rule should consist of your sellers.json domain and the publisher IDs you want to transfer.
  5. The publisher ID in the Gamoshi platform is defined by the customer number and business partner id -> <customer no.> - b<business partner id>. For example, for customer id='200' and Business partner ='1122' the publisher ID for an inventory will be '200-b1122'. 
  6. An example of a SCHAIN 'To' value when the sellers.json domain is 'test.io' and the publisher ID is '200-b1122' will be "1.0,1!test.io,200-b1122,1". If you have legacy values of sellers IDs and you are not using Gamoshi's business partner ID then for a legacy seller ID of 12345 the SCHAIN 'To' value will be "1.0,1!test.io,12345,1".
  7. You can also use a shorter version on insertion of just the sellers.json domain and seller ID for example: "test.io,200-b1122" or "test.io,12345" for a legacy value.
  8. For more information please see the below specification of the order of the properties that should appear within the serialized SCHAIN string.

Format of serialization

The serialization is composed of two items; the SupplyChainObject properties and the SupplyChainNode array. These two items are separated by a bang (“!”) character.

{SupplyChainObject}!{SupplyChainNode array}

SupplyChainObject properties

There are two properties in a SupplyChain object; version and complete. These two values must be included at the beginning of the serialized value and must be separated by a comma (“,”).

ver,complete

An array of SupplyChainNode properties

Following the SupplyChainObject properties, every node in the SupplyChain must be included. Properties of a SupplyChainNode object must be separated by a comma (“,”) and if there is more than one node, each must be separated by a bang (“!”) character.

The order of properties is as follows:

asi,sid,hp,rid,name,domain,ext

The contents of the ext property are exchange specific, no attempt is made in this document to specify the method of serialization of values for this object.

Optional SupplyChainNode property values can be omitted and trailing separators can be optionally excluded.

Example: exampleexchange.com,12345,1,,,

or

If the values in any of the properties require URL encoding (See RFC 3986 or Wikipedia post) or contain a comma or bang character, they should be URL encoded. The comma that is used to separate properties should not be encoded.

Example: exampleexchange.com,123%2CB,1,,,

This represents an sid of “123,B” on exampleexchange.com, which handles payments.So for example, this supply chain object:

{

   "ver":"1.0",

   "nodes":[

      {

         "asi":"exchange1.com",

         "domain":"publisher.com",

         "name":"publisher",

         "hp":1,

         "rid":"bid-request-1",

         "sid":"1234"

      },

      {

         "asi":"exchange2.com",

         "hp":1,

         "sid":"abcd"

      },

      {

         "asi":"example.com",

         "hp":1,

         "sid":"091381"

      },

      {

         "asi":"lastexchange.com",

         "hp":1,

         "sid":"22"

      }

   ],

   "complete":1

}

would be passed into the supply tag url like:

schain=1.0,1!exchange1.com,1234,1,bid-request-1,publisher,publisher.com!exchange2.com,abcd,1,,,!example.com,091381,1,,,!lastexchange.com,22,1,,,