npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-smart-adserver

v1.1.1

Published

Ultimate Cordova Plugin for Smart AdServer to monetize hybrid apps. Show mobile Ad with single line of JavaScript. Compatible with Cordova CLI, PhoneGap Build, Intel XDK/Crosswalk, Google ChromeApp, Ionic, Meteor, etc.

Downloads

89

Readme

cordova-smart-adserver

Cordova/PhoneGap Plugin for Smart Ad Server.

Show Mobile Ad with single line of javascript code

Step 1: Prepare SiteId, PageId, FormatId, and baseUrl, in Smart Ad Server portal, then write it in your javascript code.

	var ad_units = {};
	if( /(android)/i.test(navigator.userAgent) ) { 
		ad_units = { // for Android
            siteId: 73569,
			banner: '549527/15140',  // in pattern: '{pageId}/{formatId}'
			interstitial: '549527/12145'
		};
	} else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) {
		ad_units = { // for iOS
            siteId: 73568,
			banner: '549526/15140',
			interstitial: '549526/12145'
		};
	} else {
		alert('Windows phone not supported');
	}
    var defaultOptions = {
        siteId: ad_units.siteId,
        baseUrl: 'http://mobile.smartadserver.com',
        position: SmartAdServer.AD_POSITION.BOTTOM_CENTER,
        // offsetTopBar: false, // avoid overlapped by status bar, for iOS7+
        bgColor: 'black', // color name, or '#RRGGBB'
        isTesting: true, // set to true, to receiving test ad for testing purpose
        // autoShow: true // auto show interstitial ad when loaded, set to false if prepare/show
    };
    SmartAdServer.setOptions( defaultOptions );

Step 2: Want a banner? single line of javascript code.

// it will display smart banner at top center, using the default options
if(SmartAdServer) SmartAdServer.createBanner( {
	adId: ad_units.banner, 
	position: SmartAdServer.AD_POSITION.TOP_CENTER, 
	autoShow: true 
} );

Step 3: Want full screen Ad? Easy.

// load and display full screen Ad
if(SmartAdServer) SmartAdServer.prepareInterstitial( {
	adId: ad_units.interstitial, 
	autoShow: true
} );

Features

Platforms supported:

  • [x] Android
  • [x] iOS

Highlights:

  • [x] Easy-to-use: Display Ad with single line of javascript code.
  • [x] Powerful: Support banner, interstitial.
  • [x] Smart: Auto fit on orientation change.
  • [x] Same API: Exactly same API with other RjFun Ad plugins, easy to switch from one Ad service to another.

How to use?

  • If use with Cordova CLI:
cordova plugin add com.rjfun.cordova.smartadserver
  • If use with PhoneGap Buid, just configure in config.xml:
<gap:plugin name="com.rjfun.cordova.smartadserver" source="plugins.cordova.io"/>
  • If use with Intel XDK: Project -> CORDOVA 3.X HYBRID MOBILE APP SETTINGS -> PLUGINS AND PERMISSIONS -> Third-Party Plugins -> Add a Third-Party Plugin -> Get Plugin from the Web, input:
Name: AdMobPluginPro
Plugin ID: com.rjfun.cordova.smartadserver
[x] Plugin is located in the Apache Cordova Plugins Registry

Quick start with cordova CLI

	# create a demo project
    cordova create test1 com.rjfun.test1 Test1
    cd test1
    cordova platform add android

    # now add the plugin, cordova CLI will handle dependency automatically
    cordova plugin add com.rjfun.cordova.smartadserver

    # now remove the default www content, copy the demo html file to www
    rm -r www/*;
    cp plugins/com.rjfun.cordova.smartadserver/test/* www/;

	# now build and run the demo in your device or emulator
    cordova prepare; 
    cordova run android; 
    # or import into eclipse

Javascript API Overview

Methods:

// use banner
createBanner(adId/options, success, fail);
removeBanner();
showBanner(position);
showBannerAtXY(x, y);
hideBanner();

// use interstitial
prepareInterstitial(adId/options, success, fail);
showInterstitial();

// set default value for other methods
setOptions(options, success, fail);

Screenshots

Banner Bottom | Banner Top -------|---------- ScreenShot | ScreenShot Banner Toast | Interstitial ScreenShot | ScreenShot

Credits

This Cordova plugin is developed by Raymond Xie for Groupe Express-Roularta and Chunk Group.

Groupe Express-Roularta is the sponsor of Android code of this project, and agrees to publish as open source to benefit the community.

Chunk is the sponsor of iOS code of this project, and agrees to publish as open source to benefit the community.

See Also

Ad PluginPro series for the world leading Mobile Ad services:

More Cordova/PhoneGap plugins by Raymond Xie, find them in plugin registry.

If use in commercial project and need email/skype support, please buy a license, you will be supported with high priority.

Project outsourcing and consulting service is also available. Please contact us if you have the business needs.