1

I have this adsense ad code:

<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
    style="display:inline-block;width:728px;height:90x"
    data-ad-client="ca-pub-xxxxxxxxxxxxxxxx"
    data-ad-slot="6440411535"></ins>
<script>

source

What is a data-ad-slot for Google Adsense and why is inline styling required — aren't all ads have a fixed mobile-first styling?

This question is very much a follow up to this question.

4
+25

When you create an Adsense ad, you can select it to be either responsive or fixed size.

If it's a fixed size, you'll get the sizing thrown into the ad as part of the styling:

style="display:inline-block;width:728px;height:90x"

However, if you choose a responsive size, it will display something like this:

 style="display:block"
 data-ad-format="auto"
 data-full-width-responsive="true"

If you don't want to use inline styling, you can skip the style tag all together and define it on your css, for example:

<ins class="adsbygoogle myadstyle"

And in your css add something like:

.myadstyle{display:inline-block;width:728px;height:90x}

Regarding your second question, data-ad-slot is the code for the ad unit you've created. If you go to Ads > Ad Units, you'll see all the ads you've created for your account. Each of those has a unique ID which is the value used for that field.

  • Let's say I used the same ad code twice in a single page in order to show two ads, will revenue from the 2nd ad be generated? I had read somewhere in the web that using the same data-ad-slot will not generate any revenue and will only be counted as one. – JAT86 Aug 25 at 21:27
  • 1
    @JAT86 You can place the same code multiple times on the page, revenue will generate for each individually, however you won't be able to track which of them generated the revenue. For tracking purposes, you can either create a different ad with a different ad-slot and track it there, or use tracking channels. – Luis Alberto Barandiaran Aug 27 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.