Languages
[Edit]
EN

JavaScript - use multiple Google Ads / GPT

8 points
Created by:
chelsea
806

In this short article, we would like to show how to use multiple Google Ads / GPT in JavaScript.

Multiple Google Ads / GPT displayed with console mode.
Multiple Google Ads / GPT displayed with console mode.

Note: read official documentation to know more about GPT.

Hints:

  • run below code under your domain and use proper paths and sizes for slots to see the effect,
  • if you are using AdBlock disable it - you can find AdBlock detection test here.

The below example displays 4 Ads (single slot displays a single ad):

  • slot1 in site header:
    path: /6355419/Travel/Europe/header with size: 300x50 px,
  • slot2 and slot3 display the same ad in the site body:
    path: /6355419/Travel/Europe/body with size: 300x250 px,
  • slot4 in site footer:
    path: /6355419/Travel/Europe/footer with size: 300x50 px.

Note: /6355419/Travel/Europe was presented in the examples in the official documentation.

Practical example:

References

Edit
  1. API - Google Docs
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join