Publishers
Integration guide
Show PlatformX ads on a website or in a mobile app. Most sites are live in a few minutes.
Quick start
- Create a publisher account (or sign in).
- In your dashboard, open Ad Units and create a unit. Choose the size that fits the space on your page.
- Open Embed Code, copy the tag for that unit, and paste it into your page where the ad should appear.
- Load your page. An ad appears, and the unit’s impression count in your dashboard goes up.
Website tag
The tag has two parts: an element that marks where the ad goes, and one script. Replace the unit code with your own (your dashboard fills it in for you).
<!-- PlatformX ad unit --> <div data-px-unit="YOUR-UNIT-CODE"></div> <script async src="https://platformxapi.platformx.company/api/serve/ad.js"></script>
- The script loads asynchronously and never blocks your page from rendering.
- For several ads on one page, add one data-px-unit element per placement. Include the script only once.
- An impression is counted when at least half of the ad is visible on screen, not when the page loads.
- If no ad is available and you have not set a fallback, the element stays empty and takes no space.
- Recommended container widths: 728px for a leaderboard, 320px for a rectangle. The ad is responsive below those widths.
iframe option
Use the iframe when your site or CMS does not allow third-party scripts. It shows the same ad in an isolated frame.
<iframe src="https://platformxapi.platformx.company/api/serve/preview-html?unitCode=YOUR-UNIT-CODE" width="100%" height="280" frameborder="0" scrolling="no" style="border:none; overflow:hidden; display:block; margin:0 auto;"></iframe>
The iframe counts an impression each time it loads, whether or not it is on screen. Prefer the website tag where you can.
Mobile apps and API
Apps (Flutter, Android, iOS, React Native) and custom layouts request an ad as JSON and draw it themselves. No API key is needed; the unit code identifies you.
GET https://platformxapi.platformx.company/api/serve/ad?unitCode=YOUR-UNIT-CODE&division=Dhaka
division is optional. Send the viewer’s division (for example Dhaka, Chittagong, Sylhet) so campaigns targeted at that area can match.
{
"hasAd": true,
"creativeId": 12,
"campaignId": 4,
"headline": "Fresh groceries in 30 minutes",
"description": "Order now and pay with bKash or Nagad.",
"imageUrl": "https://.../creative.jpg",
"destinationUrl": "https://advertiser.example",
"callToAction": "Order Now",
"format": "MediumRectangle300x250",
"unitCode": "YOUR-UNIT-CODE",
"impressionTrackerUrl": "https://platformxapi.platformx.company/api/serve/impression?...",
"clickTrackerUrl": "https://platformxapi.platformx.company/api/serve/click?...",
"mediaType": "image",
"isFallback": false
}Your app has three jobs:
- If hasAd is true, show the headline, description, image or video, and call-to-action.
- When the ad becomes visible, send one GET request to impressionTrackerUrl. Without it, the view earns nothing.
- When the user taps the ad, open clickTrackerUrl in the browser. It records the click and redirects to the advertiser.
When isFallback is true, the ad is your own fallback creative: the tracker URLs are empty, so open destinationUrl directly.
// Flutter / Dart
final res = await http.get(Uri.parse('https://platformxapi.platformx.company/api/serve/ad?unitCode=YOUR-UNIT-CODE'));
final ad = jsonDecode(res.body);
if (ad['hasAd'] == true) {
// 1. Show ad['headline'], ad['description'], ad['imageUrl'], ad['callToAction']
// (ad['mediaType'] is 'image' or 'video')
// 2. When the ad becomes visible, request ad['impressionTrackerUrl'] once
// 3. When tapped, open ad['clickTrackerUrl'] in the browser
}Location, age and profession
Advertisers can aim a campaign at particular divisions, age groups and professions. Matching ads pay better, so sharing these details usually raises what your pages earn.
- Location needs nothing from you. The visitor’s division and city are worked out from their internet connection.
- Age and profession come from you, and only for signed-in visitors who gave you that detail and agreed to its use for advertising. Add the attributes to the ad element:
<div data-px-unit="YOUR-UNIT-CODE"
data-px-age="25-34"
data-px-profession="Doctor"></div>- Age groups: 18-24 25-34 35-44 45-54 55+. Do not send a value for anyone under 18.
- Professions: Student Doctor Engineer Teacher Business ServiceHolder Farmer Homemaker Freelancer Other.
- Any other value is ignored. Leave the attributes off when you do not know.
- Apps send the same values as age and prof on the ad request and on both tracker URLs.
Location lookup uses IP Geolocation by DB-IP.
What the tag collects
To measure ads and show you and the advertiser who saw them, the website tag sends the following to PlatformX with each impression and click:
- Page: the address of the page (without its query string) and its title.
- Where the visitor came from: the referring site’s domain only.
- Device: device type, browser, operating system, screen size, language and timezone.
- Location: division and city, worked out from the IP address. Nothing more precise.
- Age group and profession: only if you add them to the tag, as fixed bands.
- Viewing time: how long the ad stayed at least half visible.
- Anonymous visitor ID: a random value kept in the browser’s storage for your site (key px_vid), used to count unique visitors. It is not created when the browser sends a Do Not Track or Global Privacy Control signal.
- IP address: used to filter repeat clicks.
The tag does not read form fields, cookies, or anything your visitors type, and it does not collect names, emails or phone numbers. Mention PlatformX advertising and this measurement in your site’s privacy policy.
Apps using the JSON API can send the same details by adding these optional parameters to the impression and click tracker URLs: iid (a random 32-character hex ID you generate per ad shown), vid (a random hex ID you keep per install), pu (screen or page address), pt (title), sw, sh, lang and tz.
Controlling which ads show
- Blocked categories: ads in these categories never appear on the unit.
- Preferred categories: matching ads are shown first; other ads fill in when none match.
- Floor price: cost-per-click campaigns bidding below it are not shown on the unit.
- Fallback creative: your own image or video, shown when no paid ad qualifies.
- Pause: an inactive unit shows nothing until you turn it back on.
All of these are set per ad unit in your dashboard and take effect immediately.
Earnings and payouts
- You receive 80% of what the advertiser pays for each billed click or impression on your units.
- Earnings are added to your wallet as they happen.
- A repeat click on the same ad from the same visitor within two minutes is not billed and earns nothing.
- Request a payout to bKash, Nagad or bank from ৳500. You are notified when it is sent.
Troubleshooting
- Nothing appears where I placed the tag
- Check that the unit code matches the one in your dashboard exactly and that the unit is active. If no campaign currently matches your category rules or floor price, the space stays empty; set a fallback creative to fill it.
- The ad shows but impressions are not counted
- With the website tag, the ad must be at least half visible on screen. In an app, make sure you request impressionTrackerUrl once the ad is shown.
- My site has a Content Security Policy
- Allow the PlatformX API host in script-src, connect-src and img-src (and media-src if you show video ads). Advertiser images load from the advertiser’s own image URL.
- Clicks are not adding to my earnings
- Repeated clicks from one visitor are filtered. Clicking your own ads to test will be filtered after the first click and may lead to account review.