If you want to use a third party ad trafficking platform to target your mobile video advertisements, you can use the External Promotion option to integrate yospaceCDS with your ad server.
The basic steps on setting up advertising with an external server are:
When a request for a video is made and your External Promotion is applicable, yospaceCDS will make an HTTP GET request to a URL that you specify. The response returned by the ad server is then matched against a specified regular expression to extract the Media Item ID to insert into the video.


You can specify special tokens that are replaced with contextual information when the URL Template is being evaluated.
${TOKEN} for a simple value replacement operation${TOKEN(value1)(value2)}TOKEN.name to specify a specific external name (case sensitive).${TOKEN(=)(&)}[]) is removed.
http://server/path?[ip=${QUERY_PARAM.ip}&]somethingelse=fred resolves to http://server/path?somethingelse=fred if ${QUERY_PARAM.ip} is has no valueCONTENT_IDFEED_IDCLIENT_IPUSER_AGENTQUERY_PARAM.xxxCLIENT_HEADER.xxxADVERT_POSITION(p1)(p2)p1 is the value given if the request is for pre-roll placement and p2 is the value for post-roll placement.METADATA.xxx${METADATA(p1)(p2)} where p1 is the field assignment symbol and p2 is the tuple separation value. For example, ${METADATA(=)(;)} will result in the token being replaced as field1=value;field2=value;field3=value.
The following example, sends the Media Item ID and Feed ID to advert server. The parameter ac=Example is, for illustration purposes, how this ad server might identify the account it is doing the matching from.
http://adserver-example.net/handler?ac=Example&vid=${CONTENT_ID}&channel=${FEED_ID}
For the Media Item ID 1984102 and feed ID 1234098123 the full request will be made as:
http://adserver-example.net/handler?ac=Example&vid=1984102&channel=1234098123
The following example provides the value of the parameter udid originally specified by the Access URL to the video.
http://adserver-example.net/handler?ac=Example[&userid=${QUERY_PARAM.udid}]
For the request http://cds1.yospace.com/access..&udid=1234567, the resulting call will be made as:
http://adserver-example.net/handler?ac=Example&userid=1234567
Note that this token is surrounded by brackets ([ ]). These have the effect of removing everything that they contain if the token that they contain results in a null value. Therefore, when the incoming request in this example does not include a udid parameter, the request is made as:
http://adserver-example.net/handler?ac=Example
The following example, includes the ADVERT_POSITION to determine whether the call is requesting a pre-roll or post-roll video.
http://adserver-example.net/handler?ac=Example&type=${ADVERT_POSITION(pre)(post)}
Assuming the request was for a pre-roll advert, the request would be made as follows:
http://adserver-example.net/handler?ac=Example&type=pre
Assuming the request was for a post-roll advert, the request would be made as follows:
http://adserver-example.net/handler?ac=Example&type=post
yospaceCDS must locate the Media Item ID within the ad server's response. To do this, it employs the use of a regular expression, a common means of matching sequences of characters within text. Specifically, yospaceCDS employs Java syntax regular expressions, however Java programmers please note that it is not necessary to double escape the blackslash character in the regular expression you supply to yospaceCDS.
You should construct your regular expression return the Media Item ID as the first capture group.
Supposing that your ad server provides the following type of response:
<response>
<primary>
<params key="videourl" value=“827381"/>
<params key="class" value="direct"/>
</primary>
</response>
To extract the Media Item ID (in this example 827381) from this response, you would use the regex:
.*key="videourl"\s+value="(\d+)".*