eaCtrl Tech Documentation

You have to create one or more controllers in your account (if enabled)
After "generating" the controller you get HTML page with several examples.

Implementing the controller
After uploading the "generated" files you get a Test Page, The header contains the folowing code:

<script language="javascript" src="eaCtrl.js"></script> (Path to the controller)
<script language="javascript">

eaCtrl.debugOn=false;// set on true in case you wanna debug
eaCtrl.bypassAb=true;// option to bypass an adblocker
eaCtrl.connectors ={
	1:{'isproxy':0,'type':'url','url':'//go.eabids.com/eactrl.go'}, // default connector
	2:{'isproxy':1,'type':'path','url':'eaCtrl.php'} // Second Connector used as proxy in case the first one is blocked. If this happens this is a (PHP) script which will forward the original request. This is also possible with rewrite rules.
};
eaCtrl.init(); // Initialize the controller

</script>


Anti Adblock option
When you create/edit a controller you have the option to enable "Anti Adblock", but this will only work if you arrange a proxy.
Proxies can work in several ways:
1: A local (php) script which catches the parameters from the controller, adds the visitors IP Adress and forwards the request to our system.
2: Url rewrite (Nginx / Apache).
3: DNS CNAME from a chosen domain.
4: Url/path redirection. CloudFlare (or other CDN services which support this) .

Example rewrites (path = /eactrl)
Nginx (http)
        location /eactrl {
                proxy_set_header X-Real-IP $remote_addr; // with nginx proxy you have to forward the visitors ip
                proxy_pass http://go.eabids.com/eactrl.go;
        }
Nginx (https)
        location /eactrl {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_pass https://go.eabids.com/eactrl.go;
        }
Apache .htaccess (http and https)
RewriteEngine  on
RewriteCond %{HTTPS} !=on
RewriteRule "^eactrl" "http://go.eabids.com/eactrl.go" [P] // with option [P] the browser don't notice any "redirect" including the adblocker
RewriteCond %{HTTPS} =on
RewriteRule "^eactrl" "https://go.eabids.com/eactrl.go" [P]
If you use this, we strongly advise to use "unique" names for the proxy path and for the Controller variable "eaCtrl". You have the option to rename it during controller creation.


Available Parameters in controller cals (eaCtrl.add({});)

1: plugin: (banner, im, floater,fpa,invideo,pop,videoslider)
2: traffictype: all,desctop,mobile,iptv,!mobile,!desctop,!iptv
3: sid: Your AdspaceId
4: display: the id value of the HTML element where we add the advertisement, NOTE: be sure this element is empty since we overwrite all data there!
5: subid: (optional) a string for "subid" stats.
6: responsive: (optional default 0), for images we set the width on 100% without height param in case this property is 1.
7: fn: Only with plugin "banner" with as value "iframe" in combination with param: fn_params (json object).

Examples

The Controller can load advertisements after the page is loaded, for example with "scrolling content" you can still add an html tag with id (<div id="id_referred_in_add_call"></div>)
Bannerad Example Code
<script>
 eaCtrl.add({'plugin':'banner','traffictype':'all','sid':341279,'display':'sp_341279',subid:'','responsive':'0'});
</script>

Example code 2 with responsive banner:
<script>
 eaCtrl.add({'plugin':'banner','traffictype':'all','sid':341279,'display':'sp_341279_2',subid:'','responsive':'1'});
</script>

Example IM code:
<script>
eaCtrl.add({'plugin':'im','traffictype':'all','sid':'4882','subid':''});
</script>


Example Banner floater
<script>
eaCtrl.add({'plugin':'floater','traffictype':'all','sid':'272582','subid':''});
</script>


Example FPA:
<script>
eaCtrl.add({'plugin':'fpa','sid':'57262','subid':''});
</script>


Example Pop(under):
<script>
eaCtrl.add({'plugin':'pop','sid':'57262','subid':'','clickTags':['body'],'ignoreTags':['.nopop','#nopop','video']});
</script>

Param "clickTags" is optional and suppose to be an array with elements,class names, id values from parts in your page which can fire the pop, in this case its the whole document.
Param "ignoreTags" is optional and suppose to be an array with elements,class names, id values from parts in your page which cannot fire a pop.
In both cases you can also use jQuery wildcards since this got handled by that.
In case of id values, be sure they are unique, jQuery cannot match more than one element using the same id!.


Example for iFrame handler:it will try to load an external iFrame (can be anything) and in case the AdBlocker stops it, the system will load an alternative ad.
<script>
var fnParams = {
	'display':'iframetest','id':'myiframe','name':'iframetest','url':'//go.eabids.com/banner.go?spaceid=341279','width':'300','height':'250',
	onerror:function(){
		eaCtrl.add({'plugin':'banner','sid':'341279','display':'iframetest','subid':'','responsive':'0'});
	}
};
eaCtrl.add({'plugin':'banner','fn':'iframe','fn_params':fnParams});
</script>

Invideo PlugIn

The Invideo plugIn supports the following player types:
1: jWplayer
2: FlowPlayer
3: htm5 Video player

Since our controller have to know which playertype you have running we will show a example per player, the way of integration in your player might be a bit different.
Every example contains the full code for the player, you don't have to replace that as long you understand the integration part.

Available parameters in the code eaCtrl.add({});
1: plugin: "invideo"
2: display: The id of the element where we add the advertisement layer, in case of "html5 video" its always a div wrapper around the "video" element and in case of the other players its the div element where the player is beeing loaded.
3: playertype: html5_video,jwplayer, flowplayer,ktplayer 4: player: in case of "html5_video" its the id value of the "video" element, in case of others its always the object variable of the player which you will see in the examples.
5: sid: the spaceid of the invideo controller adspace
6: subid: (optional string for subid stats, this one will apply for all used adzones).

Example code HTML5 Video
<div id="html5_vid_wrapper">
<video id="html5_vid" width="640" height="480" controls>
     <source type="video/mp4" src="//go.eabids.com/invideo/files/flowplayer_html5/demo_video.mp4"/>
</video/>
</div>
<script language="javascript">
	eaCtrl.add({'plugin':'invideo','display':'html5_vid_wrapper','playertype':'html5_video','player':'html5_vid','sid':'246192','subid':''});
</script>

Example code JwPlayer
<div id="videojw">Loading the player...</div>
<script type="text/javascript" src="//go.eabids.com/invideo/files/jwplayer/jwplayer.js"></script>
<script type="text/javascript">
    // we use the \"player\" var as reference in the call to the controller
	var player = jwplayer("videojw").setup({
        file: "//go.eabids.com/invideo/files/jwplayer/example.mp4",
        width:680,
        height:386
    });
	// adding the ccontroller
	eaCtrl.add({'plugin':'invideo','display':'videojw','playertype':'jwplayer','player':player,'sid':'246192','subid':''});

</script>

Example code Flowplayer
<div id="flowplayerflash" style="display:block;width:680px;height:386px;border:1px;background-color:#000000"></div>
<script type="text/javascript" src="//go.eabids.com/invideo/files/flowplayer/flowplayer-3.2.12.min.js"></script>
<script>
	var player = flowplayer("flowplayerflash", "//go.eabids.com/invideo/files/flowplayer/flowplayer-3.2.16.swf",{clip: { url:"//go.eabids.com/invideo/files/reboundchick.mp4",autoPlay: false}});
		// adding the controller
	eaCtrl.add({'plugin':'invideo','display':'flowplayerflash','playertype':'flowplayer','player':player,'sid':'246192','subid':''});

</script>



Various functions
<script>
	eaCtrl.onReady(function(){
		if (eaCtrl.browserInfo.isdesctop){
			// do something
		}
	});

	eaCtrl.onReady(function(){
		if (!eaCtrl.browserInfo.ismobile){
			// do something

		}
	});

	eaCtrl.onReady(function(){
		if (!eaCtrl.browserInfo.isiptv){
			// do something

		}
	});

	eaCtrl.pause(); // this will pause the Controller, easy for use in case you want to add more Advertisements during a "Scrolling" page
	eaCtrl.resume(); // Controller continue his process and display ads which weren't displayed yet
</script>