Monetize your VApp by serving ads from our ad server. This simple code snippet illustrates how easy it is to display an ad within your VApp.

The following code is a complete VApp which displays an ad and when the user clicks on that ad and then returns to the page after viewing the offer it displays a check mark on the ad and then clears it after 5 seconds.


<!doctype html>
<html>
<head>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <title>Ads</title>
    <meta name="viewport" content="initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
   //Required helper function
    <script src=http://assets.viggleassets.com/assets/b/3/5/5/b3552a70252b2c4faa90c88e60fe1008.js></script>
</head>
<body>
  <div id="mydiv"></div>
  <br/>
        <script>

            function callback(m) {
            
            }

        (function() {

            function onBridgeIsReady() {

                window.setTimeout(function() {

                 //show ad

                  VAPP.showAd(function(m){

                        //when user returns to page after viewing ad 
                        //show check mark then hide the ad after 5 seconds

                        VAPP.displayAdCompletedCheckmark(document.getElementById('mydiv'));

                        window.setTimeout(function() {

                            VAPP.collapseAd(document.getElementById('mydiv'));
                        
                        }, 5000);    

                  }, document.getElementById('mydiv'), "http://adserver.adtechus.com/?" + 
                                                       "adrawdata/3.0/5386/2798901/0/16/ADTECH");
            
            }

            // Kick off script
            document.addEventListener('VAPPReady', onBridgeIsReady, true);
        })();
    </script>
</body>
</html>

Should you need any help while developing your VApp, ask a question in our developer forum. It is monitored by Viggle Engineers and they will help you out if the community doesn’t beat us to it.