JS Tag for Web
The JavaScript tag is the simplest way to add Praevis ads to a web page. Drop in one script tag and it handles the auction, rendering, and viewability tracking.
Basic Tag
<script src="https://rtb.praevis.com/tag.js?publisher_id={id}&w=728&h=90"></script>Replace {id} with your publisher ID.
Parameters
| Parameter | Description | Example |
|---|---|---|
publisher_id | Your publisher ID | pub_abc123 |
w | Ad width in pixels | 728 |
h | Ad height in pixels | 90 |
format | Ad format (optional) | banner (default) |
How It Works
- The script creates an iframe at the tag’s location on the page
- An auction runs at the nearest edge location (sub-5ms)
- The winning creative renders inside the iframe
- Viewability tracking starts via
IntersectionObserver - Impression pixel fires when the ad is in view
If no DSP bids, the iframe remains empty (no layout shift).
Common Sizes
| Size | Use Case |
|---|---|
728x90 | Leaderboard |
300x250 | Medium rectangle |
160x600 | Wide skyscraper |
320x50 | Mobile banner |
300x600 | Half page |
970x250 | Billboard |
Viewability Tracking
The tag uses the browser’s IntersectionObserver API to track whether the ad is actually visible on screen. An impression is only counted when:
- At least 50% of the ad is in the viewport
- The ad has been visible for at least 1 second (display) or 2 seconds (video)
This follows IAB viewability standards.
Example: Full Page Integration
<!-- Leaderboard at top of page -->
<div class="ad-slot">
<script src="https://rtb.praevis.com/tag.js?publisher_id=pub_abc123&w=728&h=90"></script>
</div>
<!-- Content here -->
<!-- Medium rectangle in sidebar -->
<div class="ad-slot">
<script src="https://rtb.praevis.com/tag.js?publisher_id=pub_abc123&w=300&h=250"></script>
</div>Tips
- Place the tag inside a container
divthat matches the ad dimensions to prevent layout shift. - Multiple tags on one page run independent auctions. Each tag fills separately.
- The tag loads asynchronously and does not block page rendering.