Custom Implementations
CrossPromote can be used in two modes:
iframe Mode is useful when you want to simply feature image ads on your website. It’s quick and can be configured within one minute.
API Mode is for advanced use cases. For example, adding CrossPromote to your mobile app for which we don’t provide an SDK for, or if you want to use metadata ads.
Metadata ad is a JSON payload that can have a custom behavior in your app.
iframe Mode (Web)
The first step when using CrossPromote in the iframe mode is adding a script tag in the head section of your website. It’s required in order to sync the size of the iframe with the size of the ad.
<head><script src="https://crosspromote.app/script.js" async></head>
Once you added the script to your page, you can move forward and add an iframe.
<body><iframe id="crosspromote-123456" src="https://crosspromote.app/iframe?appId=example.image&size=w300h250&match=preferredSize&hash=123456" style="border: none; overflow: hidden;"></iframe></body>
Take a look at the following parts:
id: used to identify the ad on your page. Must be in the following format: crosspromote-hash. hash is a random string, you can set it to any value, but id of the frame and hash in the URL has to match, and has to be unique on the whole page.appId: ID of your application. You can use example.image while developing the app, but for production environment switch it to your ID from the CrossPromote Console.size: size of the ad. Width followed by height. Can be one of the following values:- w320h50
- w320h100
- w300h250
- w468h60
- w728h90
match: matching behavior. Can be one of the following values:- exactSize (ad will always have the same size)
- preferredSize (ad will default to a particular size, but will use other size if nothing of preferred size is available)
- imageOnly (any image ad)
hash: random string to identify the ad. Must match id of the iframe.
API Mode
CrossPromote provides a single API endpoint that allows you to fetch an ad. Every time you call this endpoint, it’s registered (and billed) as a view.
GET https://crosspromote.app/api/v1/retrieve?appId=example.image&size=w300h250&match=preferredSize&client=app&platform=androidThe URL consists of the following fields:
appId: ID of your application. You can use example.image while developing the app, but for production environment switch it to your ID from the CrossPromote Console.size: size of the ad. Width followed by height. Can be one of the following values:- w320h50
- w320h100
- w300h250
- w468h60
- w728h90
match: matching behavior. Can be one of the following values:- lax (any ad type)
- exactSize (ad will always have the same size)
- preferredSize (ad will default to a particular size, but will use other size if nothing of preferred size is available)
- imageOnly (any image ad)
- metadataOnly (any metadata ad)
client: type of the requesting client.- web
- app
platform: user’s platform. Necessary for platform-specific URLs to work. One of the following values:- android
- ios
- linux
- macos
- windows
Support
If you need additional help or support with the implementation, message us at hello@crosspromote.app.