Introduction
Mediabids provides several options for integrating digital tracking and asset lookups into an advertiser’s system and/or website. These options include: Server to Server post-backs; resources for Content Management Systems such as Google Tag Manager(GTM), Tune, etc; and Mediabids Tags for client side post-packs and phone number lookups.
Mediabids follows the Cross-Origin Resource Sharing (CORS) specification for securing shared resources. All domains using Mediabids shared resources will need to be added to the Mediabids CORS policy. Please contact your Mediabids rep regarding this for more information.
Additional information about CORS, its implementation, and how to work with it can be found here: Cross-Origin Resource Sharing (CORS)
The Mediabids platform utilizes the domain mblink.it
for digital tracking. Subsequently, digital assets, redirects, and post-backs will originate from or be directed to: https://mblink.it
.
Redirects
For Mediabids campaigns utilizing redirects to a client hosted landing page, the Mediabids platform will process a user’s request, via vanity domain and/or digital click-through, and redirect said user to the landing page with the appropriate URL parameters filled.
Ex: A request to this vanity URL: http://wwww.yourvanityurl.com/deal
Will result in a redirect like this: http://wwww.yoursite.com/landingpage?mb_campaign=12345&mb_source=deal&mb_tx_id=1000
Redirect Parameters
These are the URL parameters that are part of a Mediabids redirect.
Parameter | Required | Data Type | Description |
---|---|---|---|
mb_source | yes | string | This is the Mediabids URL source code which relates to a given placement. This value is passed as a URL parameter for campaigns utilizing Mediabids redirects to client hosted landing pages. For customers not utilizing Mediabids redirects, this value takes the form of a sub directory of the requested web page: For Example: https://customer.com/deal would be sent to the Mediabids platform as such: &mb_source=deal |
mb_campaign | yes | integer | This is your Mediabids campaign id. This value is passed as a URL parameter for campaigns utilizing Mediabids redirects to client hosted landing pages, which can then be captured for a post-back. This useful for customers with multiple campaigns. For customers not utilizing Mediabids redirects, the customer will be provided with the campaign id(s) which can either be hardcoded, or the customer will be responsible for managing which campaign ID is sent back dependent on incoming URL tracking code. |
mb_tx_id | yes | integer | This is the transaction id for the post-back. This value is passed as a URL parameter for campaigns utilizing Mediabids redirects to client hosted landing pages, which can then be captured for a post-back. If there is no mb_txid available for the landing page post-back, a new one will be assigned and returned as part of the JSON response. This value would then be captured from that response and sent to the conversion post-back for that transaction. |
Post-Backs
Post-backs are standard HTTPS requests sent to the Mediabids platform from the client to log a specific activity such as a ‘landing page visit’ or a ‘sales conversion’. There two basic types: server-to-server and client-to-server, specifics for each can be found below.
Query Parameters
These are the URL parameters needed to submit a post-back request.
Parameter | Required | Data Type | Define by | Description |
---|---|---|---|---|
mb_source | yes | string | Mediabids | The Mediabids URL source code which relates to a given placement. This value is passed as a URL parameter for campaigns utilizing Mediabids redirects to client hosted landing pages. For customers not utilizing Mediabids redirects, this value takes the form of a sub directory of the requested web page: For Example: https://customer.com/deal would be sent to the Mediabids platform as such: &mb_source=deal |
mb_campaign | yes | integer | Mediabids | The Mediabids campaign id. This value is passed as a URL parameter for campaigns utilizing Mediabids redirects to client hosted landing pages, which can then be captured for a post-back. This useful for customers with multiple campaigns. For customers not utilizing Mediabids redirects, the customer will be provided with the campaign id(s) which can either be hardcoded, or the customer will be responsible for managing which campaign ID is sent back dependent on incoming URL tracking code. |
mb_amt_tot | no | decimal | Client | Total sales amount, in dollars, associated with a conversion. |
mb_amt_com | no | decimal | Client | The total commission amount, in dollars, associated with a conversion. |
reference_id | no | string (45 chars max) | Client | A client defined value for referencing a given post-back, such as an internal ‘Order Number’ or ‘Transaction Id’. |
test | no | boolean | Client | Indicator if a request is a test. Test requests go through the same validation processes and generate identical responses as live requests but are stored in a sandbox database, which can then be inspected via the Integration Portal. For initial set-up, campaigns are set to test mode, which will treat all request as tests, regardless of this parameter’s value. Once a campaign is confirmed and switched to live, this parameter can then be used to issue test requests. |
Endpoints
The main component of a post-back, regardless of type, is the endpoint. There are two basic endpoints for the Mediabids platform:
Landing Page Visit - Used to indicate when user reaches a target landing page.https://mblink.it/post-back/lpa?mb_campaign={mb_campaign}&mb_source={mb_source}
Pre-Autherization - Used to indicate a pending conversion. This is atypical and your Mediabids Integration Portal will direct you when this should be used.https://mblink.it/post-back/auth?mb_campaign={mb_campaign}&mb_source={mb_source}&mb_txid={mb_txid}&{optional parameters}
Conversion Confirmation - Used to indicate a fully completed conversion such as sale or form submission:https://mblink.it/post-back/cpa?mb_campaign={mb_campaign}&mb_source={mb_source}&mb_txid={mb_txid}&{optional parameters}
Endpoints to your specific campaigns can be found in the Integration Portal
Server to Server
Server-to-server post-backs are the preferred method for sending post-back request to Mediabids. They are typically more reliable and more secure. The are more reliable because they are not affected by cookie limitations such as cookie blocking. This is especially true for mobile devices where it is more common to have cookies turned off by default. There are also more secure because it prevents practices such as cookie stuffing or manipulation.
Server–to-server post-backs do require more in-depth technical resources to implement and typically require a little bit coding. However, once setup, server-to-server post-backs are the most accurate and seamless way to report tracking activities.
To send a server-to-server visit confirmation post-back:
See Ruby, Java, or Bash
http = Net::HTTP.new("mblink.it/post-back/lpa?mb_campaign=12345&mb_source=deal", 443)
http.use_ssl = true
path = "uri"
resp, data = http.get(path, nil)
See Ruby, Java, or Bash
String endPoint = "https://mblink.it/post-back/lpa?mb_campaign=12345&mb_source=deal";
URL u = new URL(endPoint);
InputStreamReader isr = null;
HttpURLConnection uc = (HttpURLConnection) u.openConnection();
isr = new InputStreamReader(uc.getInputStream());
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null) returnData += inputLine;
in.close();
curl "https://mblink.it/post-back/cpa?mb_campaign={mb_campaign}&mb_source={mb_source}"
The above command returns JSON structured like this:
{
"code": 200,
"status": "OK",
"type": "Visit"
}
Mediabids Tags
As an alternative to server-to-server post-backs, Mediabids also offers a set of client side Mediabids Tags, which can be placed on landing and conversion pages to track user actions. Sometimes referred to as tracking ‘pixels’ or ‘beacons’, client-side tags are the most common method of user tracking.
Mediabids Tags are light weight JavaScript scriptlets that manage incoming ids and source codes through the use of first party cookies (cookies stored for the client’s domain). Your custom Mediabids Tags are customized to store tracking data based on the terms of your individual campaign(s).
Mediabids tags for your specific campaigns can be found in the Integration Portal
An example of a Mediabids Tag for a landing page:
<script>
document.addEventListener("DOMContentLoaded", () => {
const up = new URLSearchParams(window.location.search);
if(up.get('mb_campaign')){
const d = new Date();
d.setTime(d.getTime() + (#LENGTH#*24*60*60*1000));
let expires = "expires="+ d.toUTCString();
document.cookie = "mb_campaign=" + up.get('mb_campaign') + ";" + expires;
if(up.get('mb_source')){
document.cookie = "mb_source=" + up.get('mb_source') + ";" + expires;
}
}
fetch('https://mblink.it/post-back/lpa?mb_campaign='+up.get('mb_campaign')+'&mb_source='+up.get('mb_source')+'&t=true');
});
</script>
See HTML
See HTML
See HTML
See HTML
An example of a Mediabids Tag for a phone number lookup (see Phone Number Lookup for options):
<script>
const up = new URLSearchParams(window.location.search);
var jsscr="?mb_campaign="+up.get('mb_campaign')+"&mb_source="+up.get('mb_source')+"&pf=1-&i"+Math.floor(Math.random()*100)+"="+Math.floor(Math.random()*100);
var s = document.createElement('script');s.setAttribute('type','text/javascript');s.setAttribute('src',"https://mblink.it/asset/phone-number/"+jsscr);document.getElementsByTagName('head')[0].appendChild(s);
</script>
See HTML
See HTML
See HTML
See HTML
Google GTM
For customers utilizing Google Tag Manager (GTM), Mediabids provides two tag templates to easily create the requisite tracking tags for your website. These templates can be found in the Google Community Template Gallery, or can be downloaded directly from the Mediabids GitHub page and manually imported.
Google Community Template Gallery
Third Party CMS
For customers using a third-party Content Management Systsm (CMS), such as TUNE or iFramely, Mediabids endpoints are used to setup post-back tracking, each according to their own system specifications and guidelines. These systems are able to take in a tokenized endpoint and manage incoming parameters, sending the required information to Mediabids through their own post-back systems. Please refer to their documentation for instruction on how to setup post-backs in their system.
Endpoints to your specific campaigns can be found in the Integration Portal
Asset Look Up
Phone Number Lookup
Query Parameters
Parameter | Required | Data Type | Description |
---|---|---|---|
mb_source | yes | string | This is the Mediabids URL source code which relates to a given placement. |
mb_campaign | yes | integer | This is your Mediabids campaign id. |
prefix | no | String | The prefix to prepend to the begining of the returned phone number. Default is no prefix. Ex: 800-123-4567 |
default-phone | no | String | Overrides the default phone number assigned to a campaign in the mediabids system. |
dom-type | no | ‘name’,’id’,’data-phone’ | For JavaScript return type, this indicates what DOM object type will be replaced with the updated phone number. If a single element is to be updated, ID is preferred. Otherwise, Name or ‘Data-Phone’ can be used to replace multiple occurrences. Name requires a value for ‘element-name’. Data-Phone will update every element with the attribute ‘data-phone’ specified. |
element-name | no | String | For javascript return type using name or id DOM type,this indicates the name or id of the element(s) to be updated. |
css-class | no | String | For HTML return type, this indicates what style class should be applied to the returned HTML element. |
Return Format
A phone number lookup can return several different formats. By specifying a specific file name extension to a request, the Mediabids platform will return the phone number formatted based on that extension:
Utilizing a basic fetch like this:
let url = 'https://mblink.it/asset/phone-number.{file_extension}?mb_campaign={mb_campaign}&mb_source={mb_source}';
let response = fetch(url);
if (response.ok) {
console.log(response.text());
} else {
console.log(response.status);
}
With a call to .js:
https://mblink.it/asset/phone-number.js?mb_campaign=123456&mb_source=deal&dom-type=name&element-name=adiffname&prefix=1-&css-class=phone-format
Returns a function like this:
var mblx = document.getElementsByName('adiffname');for (var mbli = 0; mbli < mblx.length; mbli++) {mblx[mbli].innerHTML = '<a class="phone-format" href="tel:1-855-722-5568">1-855-722-5568</a>';}
With a call to .json:
https://mblink.it/asset/phone-number.json?mb_campaign=123456&mb_source=deal
returns JSON structured like this:
See javascript
{
"mb_campaign": "123456",
"mb_source": "deal",
"phone_number":"800-123-4567"
}
See javascript
See javascript
See javascript
With a call to .html:
See javascript
https://mblink.it/asset/phone-number.html?mb_campaign=123456&mb_source=deal&css-class=phone-format
See javascript
See javascript
See javascript
See javascript
See javascript
See javascript
returns HTML structured like this:
See javascript
<a class="phone-format" href="tel:1-800-123-4567">800-123-4567</a>
See javascript
See javascript
See javascript
With a call to .txt:
See javascript
https://mblink.it/asset/phone-number.txt?mb_campaign=123456&mb_source=deal
See javascript
See javascript
See javascript
returns plain text structured like this:
See javascript
800-123-4567
See javascript
See javascript
See javascript
Extension | Description |
---|---|
.js |
Returns a lightweight JavaScript function to replace occurrences of a phone number on a page. |
.json |
Returns the phone number as a JSON object |
.html |
Returns an anchor tag containing the phone number. |
.txt |
Returns a plain text string containing the phone number. |
Return Codes
The Medibaids API uses the follwing retun codes and status descriptions
Return Code | Meaning |
---|---|
200 | OK – Your request was successfuly processed |
204 | OK – mb_source source unknown |
205 | OK – mb_source source missing |
206 | OK – Invalid amount |
404 | Campaign Not Found – Invalid campaign id |
405 | Invalid Campaign – Campaign does not have digital tracking enabled |
500 | Internal Server Error – We had a problem with our server. Try again later. |
503 | Service Unavailable – We’re temporarily offline for maintenance. Please try again later. |