{"id":20372662,"url":"https://github.com/txchen/adunite","last_synced_at":"2025-07-04T19:04:22.993Z","repository":{"id":72708573,"uuid":"68154209","full_name":"txchen/adunite","owner":"txchen","description":"cordova-plugin-adunite","archived":false,"fork":false,"pushed_at":"2017-02-26T06:02:10.000Z","size":1617,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-15T06:47:53.961Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/txchen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-13T23:00:09.000Z","updated_at":"2016-09-13T23:49:36.000Z","dependencies_parsed_at":"2023-03-03T00:45:33.279Z","dependency_job_id":null,"html_url":"https://github.com/txchen/adunite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txchen%2Fadunite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txchen%2Fadunite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txchen%2Fadunite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txchen%2Fadunite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/txchen","download_url":"https://codeload.github.com/txchen/adunite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241921841,"owners_count":20042763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T01:14:21.781Z","updated_at":"2025-03-04T20:42:39.311Z","avatar_url":"https://github.com/txchen.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# adunite\nads plugin for cordova app, only support interstitial/video ads type.\n\nNow adunite supports the following networks:\n\n* Admob\n* Applovin\n* Adcolony\n* Chartboost\n\n## Usage\n\nFirst, add the plugin to your cordova project:\n\n```\ncordova plugin add cordova-plugin-adunite --save\n```\n\nNote: applovin sdk read the key from meta data, instead of code. You must define your sdk key in the plugin config, like this in `config.xml`:\n\n```\n\u003cplugin name=\"cordova-plugin-adunite\" spec=\"~LATEST_VERSION\"\u003e\n    \u003cvariable name=\"APPLOVIN_KEY\" value=\"YOUR_SECRET_KEY_FROM_DASHBOARD\" /\u003e\n\u003c/plugin\u003e\n```\n\n### Config your placements\n\nThe first thing you should do in your app, is to call `configAds` method.\n\n```js\nadunite.configAds({\n    showCooldown: 60, // default showCooldown in seconds for each network\n    loadCooldown: 25, // default loadCooldown in seconds for each network\n    globalShowCooldown: 45, // after user see an ad, he can see the next only after 45 seconds\n    initLastShow: new Date().getTime(),\n    maxLoadRetry: 10,\n    networks: {\n      admob: { name: 'admob', pid: 'YOUR_ADMOB_PID', weight: 100, maxLoadRetry: 15 },\n      applovin: { name: 'applovin', pid: 'ANY_STRING', weight: 70, showCooldown: 50 },\n      adcolony: { name: 'adcolony', pid: 'APPID_ZONEID', weight: 70 },\n      cb: { name: 'cb', pid: 'APPID_APPSIGNATURE', weight: 70 },\n    }\n  }, function (actualAdsOption) {\n    // successCallback\n    // actualAdsOption = merge(yourInput, aduniteDefault)\n  }, function (err) {\n    // errorCallback\n  })\n```\n\nThe first argument of `configAds` is your adsOptions. Adunite has a default one internally, and your input will merge with that one:\n\n```js\n{\n  showCooldown: 60, // default showCooldown in seconds for each network\n  loadCooldown: 25, // default loadCooldown in seconds for each network\n  globalShowCooldown: 0, // 0 means disabled. Otherwise it is a global show cooldown in seconds\n  initLastShow: 0,\n  maxLoadRetry: -1, // -1 means no limit\n  networks: {\n    admob: { name: 'admob', pid: null, weight: 100 },\n    applovin: { name: 'applovin', pid: null, weight: 100, maxLoadRetry: -1 },\n    adcolony: { name: 'adcolony', pid: null, weight: 100, maxLoadRetry: -1 },\n    cb: { name: 'cb', pid: null, weight: 100 },\n  },\n}\n```\n\nFor `applovin`, since the key is already defined in config.xml, you just need to put any non-empty string to enable it.\n\nThere are two cooldown settings here, `showCooldown` resets when ads appear, and `loadCooldown` resets when ads load. This is a per network setting, you can set them in each network, or the top level default one will be applied to each network.\n\nYou can set `initLastShow` to `new Date().getTime()` or `new Date().getTime() - 30000` for example, to prevent ads coming out too soon in your game. If you don't set, each network will have it as 0, so that right after the 1st load, they can show, it might be too fast and might affect your app experience.\n\n`maxLoadRetry` can be used to limit the retry attemps count. For example, one of your placement is not approved yet, you will always get error when you load. Set this value can limit the retry count, otherwise, it will retry forever. Like the cooldown settings, global setting is used if network level value is not specified.\n\nAlso, other than the network level `showCooldown`, you can also define a global show cooldown value `globalShowCooldown`. This can be helpful if you don't want your user to see the ads too frequently. By defautl this is disabled if you don't set it.\n\n### Show ads\n\nYou don't need to care about loading ads, adunite will do all the dirty work for you. The only thing you need to do, is to call `showAds` in the proper positions, like when game is over, when gamer enters the next stage, when gamer wants extra life, etc.\n\nCalling it cannot be easier:\n\n```js\nadunite.showAds(1500 /* delay */, function (network) {\n    // successCallback\n  }, function (err) {\n    // errorCallback\n  })\n// delay can be used when your game or app have some tween/animation you want to show user first.\n// if you don't need it, set to 0.\n```\n\nadunite will pick one of the ready ads, based on the weight, randomly pick one and show it.\n\nThat's it!\n\n### Some extra bonus\n\n`getAvailableAds` can be useful, if your game want to do some rewards to user.\n\nFor example, game is over, you want to offer a choice to your user: you can watch a video ads to get an extra life to revive and continue. In this case, you can do like this:\n\n```js\n// when game is over\nvar readyAds = adunite.getAvailableAds() // will return an array\n// check the array, and optionally render your UI\n```\n\n## Changelog\n\n**2017-02-25** `1.6.1`\nAdd back the get carrier function.\n\n**2017-02-25** `1.6.0`\nRemove READ_PHONE_STATE permission.\n\n**2017-02-24** `1.5.0`\nRemove permissions that google does not like.\n\n**2017-02-24** `1.4.0`\nRemove FBAN support.\n\n**2017-02-24** `1.3.0`\nRemove UnityAds support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxchen%2Fadunite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftxchen%2Fadunite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxchen%2Fadunite/lists"}