Set up overlay ads


  1. Register your website under "My Apps"


     
  2. Register each ad space you wish to integrate in your website under "My Ad Units"


     
  3. After registering ad unit (ad space), click on "Code Snippet" next to your registered ad unit to get the tag to be integrated in your app / webpage.



     

    For website

    320 x 250 ad space tag would be - You need to change values in bold with your website's appId, ad unit Id, tags and ad unit's overlay position on screen

    
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
    // Here "addEventListener" is for standards-compliant web browsers and "attachEvent" is for IE Browsers.
    var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
    var eventer = window[eventMethod];
    var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
    
    //Listen to message from tqiFrame
    eventer(messageEvent, function (e) {
    	if (e.origin == 'http://adserver.tapcliq.com') {			
    		if(e.data == "change") {
    			window.document.getElementById('tqframe').parentNode.focus();
    		}
    		else {
    			closeMe(e.data);
    		}
    	}
    }, false);  
    </script>
    <script type="text/javascript">						
    var tq_appid = "c6048b1b78c549509c43596492409884"; // replace this with your registered appId for the website
    var tq_tags = "lifestyle,news";  // You can add multiple comma separated content based tags - this is important as ad campaigns are delivered based on these tags
    var tq_adunitid;
    var tq_adheight;   
    var tq_adleft;  // (optional) distance from left of the screen for the frame
    var tq_adbottom;  // (optional) distance from bottom of the screen for the frame 
    var userId;
    </script>
    <script type="text/javascript" src="http://adserver.tapcliq.com/adserver/rest/resources/js/showtqad.js"></script>

    Now you can request for an ad from tapcliq on any page by calling getTqAd function with parameters "ad_height", "coordinate_from_left", "coordinate_from_bottom", "your_registered_ad_unit_id_for_this_ad_size")


    Example
    For example if you have registered 3 ad units namely 320 x 50
    You can request for them in your page as below :
    getTqAd("50","0","0","186") -> This will request for 320 x 50 ad which would be displayed at the bottom of the screen, 20 pixels from the left

    NOTE:
    Overlay ad will go away after being displayed

     

    For iOS app

    NOTE:
    For first time integration you should (1) Integrate SDK (2) Set up Ad View (code snippets) , and (3) Request Ads --> Follow integration steps HERE

    Integrate ad view

    if ( ab == nil) 
    {
    	ab = [[AdvBar alloc] initWithAppId:@"${adunits.app_id}"  // Replace this with appId value received on registering your website / app
    	origin:CGPointMake(x_axis_of_the_adView,y_axis_of_the_adView) 
    	from:self
    	adType:@"${adtype_ios}"  // Based on the ad size you wish to integrate, value  can be @"Square_Ad" or @"FullScreen_Ad" or @"700x90" (Detail View of a SplitViewController) or @"1024x90" (Full Width) or @"Small_Ad" (for a 320x50 ad)
    	adUnitId:${adunits.ad_unit_id}  // Value received on registering this ad space under Ad Units (integer value) ];
    	ab.tag =${comma separated content tags};;  // Content tags or keywords (separate multiple keywords/tags with comma)
    	ab.mydelegate = self;
    	[self.view addSubView:ab]	
    }
    							

    NOTE:
    ab: Variable that refers to the integrated ad view
     

    Please set ad view object properties to nil in it's parent view controller's dealloc.

    - (void)dealloc {
    ab.timeOutForQuestion = nil;
    ab.calledBy = nil;
    ab = nil;
    }

    Now to invoke an ad, post a notification with content tags (tags pertaining to the content in which ad view is integrated):

    NSDictionary *dict = [[NSDictionary alloc] initWithObjects: [NSArray arrayWithObject: @"comma_separated_content_based_tags"] 
    forKeys: [NSArray arrayWithObject:@"Tags"]];  
    
    [[NSNotificationCenter defaultCenter] postNotificationName: @"CustomTrigger" object: self userInfo: dict];
    						

    NOTE:
    comma_separated_content_based_tags:
    Example: if ad view is integrated on content pertaining to food & coffee shops, you can pass tags like coffee,restaurant,food

     

    For Android app

    NOTE:
    For first time integration you should (1) Integrate SDK (2) Set up ad view and request ads --> Follow integration steps HERE

    You can record occurrence of any moment & invoke a relevant ad by below mentioned code snippet

    private ${adtype_android} mAdBarView;
    mAdBarView = ${adtype_android} findViewById(R.id.adBarView);
    mAdBarView.showAd("${adunits.app_id}", "${adunits.ad_unit_id}");

    NOTE:
    - ${adtype_android}: Based on the ad size you want to integrate this value can be AdView320X50 OR AdViewWidthX90 OR AdView320X240 OR AdViewFullScreen
    - ${adunits.app_id}: Replace this with appId value received on registering your website / app
    - ${adunits.ad_unit_id}: Value received on registering this ad space under Ad Units (integer value)
     

    Now to invoke an ad, request a tag based ad (tags pertaining to the content in which ad view is integrated):

    mAdBarView.requestTagBasedAd("comma_separated_content_based_tags");

    NOTE:
    - comma_separated_content_based_tags -
    Example: if ad view is integrated on content pertaining to food & coffee shops, you can pass tags like coffee, restaurant, food.

     

    To stop ads:

    mAdBarView.requestTagBasedAd(null)

Back to Top