Publisher » PUB - Tutorials

ID #1024

JWPlayer: How to embed ads in my player?

Adxpansion has made it very easy for publishers that use JWPlayer to embed ads into their players.

See a
Demo Here


Step 1: Create a new 300x250 ad zone:

From the publisher interface, go through every step to obtain the proper linking code for a new 300x250 zone.


Step 2: Obtain the zone_id from your generated ad zone code:

You will later on need the zone_id that is specified in the generated code. So take note of the zone_id to use it in Step 3.

<!-- Generated by AdXpansion -->
<script type="text/javascript" src=" <br><a target="_top" href="" mce_href="" style="background-color:#FFFFFF;color:#000000;font-size:9px;border:none;font-family:verdana, sans-serif;padding:0;margin:0;">ads by AdXpansion</a>
<!-- End of AdXpansion code --> 

 Step 3: Insert the following javascript line on your website pages, before your player:

You need to insert this code and insert the zone_id obtained in step 2. If you are using swfobject, we suggest you insert the code just after calling the swfobject script.

<script type="text/javascript" src="" mce_src=""></script>


 Step 4: Make sure you enable javascript and set the flash to be transparent in your movie embed code:


If you are using swfobject:



If you are not using swfobject:

<embed width="640" height="480" flashvars="file=yourfile.mp4" allowfullscreen="true" quality="high" name="player" id="player" style="" src="player.swf" mce_src="player.swf" type="application/x-shockwave-flash"> 


If you are using JWPlayer version 3:




Advanced Usage:


Javascript Integration

If you are already interacting with your player using Javascript, using adxplayer code is a bit more complicated, but is still something you can do.

Make sure you load the adXpansion ad tag BEFORE your own javascript.

For JwPlayer4 and JwPlayer5:

function playerReady(a) {

Your own code here


For JwPlayer3:

function getUpdate(typ,pr1,pr2,pid) {
Your Own code is here


 Customizing the look of the Ad:

If you want to modify the look of the Ad, it's possible by redefining some javascript variable. Here's an example you can use.

<SCRIPT type="text/javascript">

var adx_adhead = '<div style="background: lightgrey; font-family: Verdana; font-size: 11px; color: rgb(51, 51, 51); text-decoration: none; border: 1px solid rgb(119, 119, 119); padding:10px;"><span style="font-weight: bold; font-size: 10px; float: left; margin-bottom: 1px; margin-left: 1px;">Advertisement</span><center>'

var adx_adfoot = '<div style="margin-top: 5px; font-size: 16px;"><a onclick="nojavascript...adxclose();return false;" href="" mce_href=""><strong>Close &amp; PLAY</strong></a></div></center></div>'


<script type="text/javascript" src=""> 


Showing Ads before the movie is started:

If you prefer, you can show the ad before the video is started.

<SCRIPT type="text/javascript">

var adx_displayonload=1;


<script type="text/javascript" src="">


Tags: -

Related entries:

Last update: 2011-03-22 13:11
Author: AdXpansion Admin
Revision: 1.15

Digg it! Print this record Send to a friend Show this as PDF file

You cannot comment on this entry