Union Ad Code with JavaScript Integration Development Guide

From UC Union Wiki
(Redirected from JS Code)
Jump to: navigation, search

This document is intended for the developers who uses UC Union Server to Server service and uses JavaScript as programming language.

Features


1.Support Banner format

2.Support Text link format

3.Support Curtain Point for Appwall

How to get the codes



Version:1.2.0.0

Resource: http://admaster.union.ucweb.com/js/union_html5_sdk.js

API


1. Namespace

Umobi

2. Methods

Umobi.AdView(options)
options: object
.pub

Type: String

A String which your pub identifies information.

.container

Type: Element or String

A DOM Element, or a Document ID in a string, that locates AD content.

.format_type

Type:Umobi.AdFormatType

A String is requested the AD type as a Banner , a Text Link on a Curtain point.

Version: 2.0.0.0

Umobi.AdFormatType
.BANNER
.TEXT
.CURTAIN


3. Sample Codes

  • Show Banner Sample Codes

You can locate a placement embedded in the HTML document.


<script src="http://admaster.union.ucweb.com/js/union_html5_sdk.js"></script>
<script>
try{ 
Umobi.AdView({
pub:"ssr@test",
format_type:Umobi.AdFormatType.BANNER
});
}catch(e){}
</script>
<noscript><a href="http://click.union.ucweb.com/?pub=ssr@test"><img src="http://slot.union.ucweb.com/?pub=ssr@test&format_type=img"></a></noscript>


Or support PHP Website with below codes.

<script src="http://admaster.union.ucweb.com/js/union_html5_sdk.js"></script>
<script>
try{ 
Umobi.AdView({
  pub:"ssr@test",
format_type:Umobi.AdFormatType.BANNER
});
}catch(e){}
</script>
<noscript><?php $tm=uniqid();?>
<a href="http://click.union.ucweb.com/?pub=ssr@test&tm=<?php echo $tm?>"><img src="http://slot.union.ucweb.com/?pub=ssr@test&format_type=img&tm=<?php echo $tm ?>"/></a></noscript>


  • Show a Text Link Sample Codes

You can locate a placement embedded in the HTML document.

<script src="http://admaster.union.ucweb.com/js/union_html5_sdk.js"></script>
<script>
try{ 
Umobi.AdView({
pub:"ssr@test",
format_type:Umobi.AdFormatType.TEXT
});
}catch(e){}
</script>
<noscript><a href="http://click.union.ucweb.com/?pub=ssr@test"><img src="http://slot.union.ucweb.com/?pub=ssr@test&format_type=img"></a></noscript>


Or support PHP Website with below codes.

<script src="http://admaster.union.ucweb.com/js/union_html5_sdk.js"></script>
<script>
try{ 
Umobi.AdView({
pub:"ssr@test",
format_type:Umobi.AdFormatType.TEXT
});
}catch(e){}
</script>
<noscript><?php $tm= uniqid();?>
<a href="http://click.union.ucweb.com/?pub=ssr@test&tm=<?php echo $tm ?>"><img src="http://slot.union.ucweb.com/?pub=ssr@test&format_type=img&tm=<?php echo $tm ?>"/></a></noscript>


  • Show a Curtain Point Sample Codes Sample Codes

You can locate a placement embedded in the HTML document.

<script src="http://admaster.union.ucweb.com/js/union_html5_sdk.js"></script>
<script>
try{ 
    Umobi.AdView({
        pub:"ssr@test",
        format_type:Umobi.AdFormatType.CURTAIN
    });
}catch(e){}
</script>


Note:

If you want only banner ads be shown on one ad slot, remember to use the .banner parameter.
If you want only text ads be shown on one ad slot, please use .text parameter on your code.
If you want a random demonstration of banner and text ads on one ad slot, just delete the ads format parameter .
Every ad slot in one website page can be presented in different types of ads format by using associated parameter.

Demo


http://admaster.union.ucweb.com/sdk_demo/