Help Center

Integration into site pages

Integrating an advertising block into a site

To directly integrate ad units into website pages:

  1. Copy the JavaScript code from the ad unit settings in your account.
  2. Paste the code into the website in the place of the HTML page where the ad unit should be displayed.
  3. The same unit (one slot_id) can be placed multiple times on a page without changing the slot_id.

Example of basic code

<script async src="https://ad.mail.ru/static/ads-async.js"></script>
<ins 
  class="mrg-tag"
  style="display:block;width:100%;text-decoration:none;"
  data-ad-client="ad-1111111"
  data-ad-slot="1111111">
</ins>
<script>
  (MRGtag = window.MRGtag || []).push({});
</script>

data-ad-slot — this is the slot_id of the ad unit (can be found in the settings)

Examples for specific formats

We support: 240x400, 300x250, 300x300, 300x600, 320x50, 336x280, 970x250. Let's look at the code using the example of 240x400.

240х400

<script async src="https://ad.mail.ru/static/ads-async.js"></script>
<ins 
class="mrg-tag" 
style="display:inline-block; width:240px; height:400px; text-decoration: none;" 
data-ad-client="ad-%slot_id%" 
data-ad-slot="%slot_id%">
</ins>
<script>
(MRGtag = window.MRGtag || []).push({})
</script>

For the remaining sizes, only the parameters in the style attribute change — width, height.

Adaptive block

<ins class="mrg-tag" data-ad-client="ad-%slot_id%" data-ad-slot="%slot_id%"></ins>

Fullscreen block

<ins class="mrg-tag" data-ad-client="ad-%slot_id%" data-ad-slot="%slot_id%"></ins>

inPage

<ins class="mrg-tag" style="display:block; text-decoration: none;" data-ad-client="ad-%slot_id%" data-ad-slot="%slot_id%"></ins>

Sticky

<ins class="mrg-tag floating" style="display:inline-block; width:320px; height:50px;" data-ad-client="ad-%slot_id%" data-ad-slot="%slot_id%"></ins> 

AMP formats

AMP Medium (300x250)

<amp-ad width="300" height="250" type="mytarget" data-ad-slot="%slot_id%"></amp-ad>

AMP Standard (320x50)

<amp-ad width="320" height="50" type="mytarget" data-ad-slot="%slot_id%"></amp-ad>

AMP Leaderboard (728x90)

<amp-ad width="728" height="90" type="mytarget" data-ad-slot="%slot_id%"></amp-ad>

If you have any questions about installing ad units, please contact support.