indieads.github.io

This repo is used to store the Indie Ads content.

In the future you will be able to upload your capsules and href file through the API and use it yourself in both Unity and HTML/Javascript.

Indie Ads Documentation:

Javascript & HTML
Here you will find the documentation describing how to use the IndieAds API on your HTML website.

Below you can also download a simple Javascript file that makes it possible to use IndieAds without having to write Javascript.
Source code:
Implementation
HTML:
Write the above line in the < header > of your HTML document.
To display an Indie Ad on your page, simply write the above line in your HTML document.

The div has to be inside the < body > of the page.

Only the class name "indieads" is needed for the API to work.

You can add the size to the classnames if you are using the free script available below.
CSS:
By default, the ads will take the size of their resolution.

You can change this manually by doing standard css.

Here, I have given all ads a white outline.
Javascript:
No custom javascript is needed if you use the script below.

This script will automatically spawn all ads if your divs meet the following criteria:
- "indieads" is the first classname.
- The second classname is the resolution. See HTML screenshot.
If you use the script below, insert the line seen above at the very bottom of your < body > element.
If you want to manually control the js, these two functions are all that is required to use the API.

spawnIndieAd(ad, res) will spawn a clickable ad which opens a new page when clicked.
spawnIndieAd_ImageOnly(ad, res) will spawn the same ad, except it can't be clicked.

"ad_1" and "ad_2" are references to the div elements you created above.

The resolution parameter takes one of the resolutions below.
Ad Resolutions:
AdResolutions.Banner_320x50

AdResolutions.Landscape_231x87

AdResolutions.Landscape_460x215

AdResolutions.Landscape_616x353

AdResolutions.Portrait_374x448

AdResolutions.Portrait_600x900
Downloads:

indieads.css

Download [1KB]

indieadsloader.js

Download [2KB]

Unity Package
The Unity Package uses HTTPRequests to fetch the ads and automatically replaces UI Images or Material Textures. All you need to do is attach the scripts and assign the Ad-Size.

See below to learn how to use the scripts.
Source code:
Implementation
Inspector:
Attach the script shown above to your GameManager.

This script manages all Indie Ads in your game.

You can write a number of seconds to refresh the ads every now and then. Any number under or equal to 0 will disable refreshing.

You can also provide the name of your game to exclude your own ads from being shown inside your game. ( This will not exclude your ads from anywhere else )
Attach these two scripts to respectively 3D GameObjects and UI Images with a MeshRenderer.

The Package also provides prefabs with these scripts already attached.

All you have to do now is set the correct ad size and the image / material texture should be replace with an Indie Ad once you press play.

Additionally for UI Images, you can attach a standard Button component to the GameObject and link it. Once you the ad is loaded, you should be able to click on the ad and it will take you to it's target website.

IndieAds.unitypackage

Download [294KB]