Anviam Blog

If you are a Developer and you are working in ROR technology, then in some projects client ask to show google ads on website. In ruby on rails implement google ads on website is very easy. There are some steps to implement google ads.

The following steps are necessary to implement google ads.
1- First of all, you need a client google ads account which is approved by google. It means client register the website domain for taking access of google ads.

2- Once google confirm the request, then we need the google adsense client id which is approved by the google and also we need the google adsense login credentials.

3- After getting the login credentials, then first we have to login into google adsense, and if client doesn’t ask you to put google ads on a particular place then simply paste <script data-ad-client=”<%= client_id %>” async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js“></script> in your projects layout which is by default apply on all pages of the website.
NOTE:- This script is for responsive google ads which means it takes the space on page automatically.

When You put code for google ads but it is not loading then it will be shown like above.

4- And if client ask you to put google ads on some particular place in all pages, then you need to create google ads unit for all the pages according to the space. Google ads unit option lies under the ads/overview/ and then click on ads unit tab.

5- Now create google ads unit for all the pages according to the space. For this you need to give size (i.e height and width) of google ads. And then simply submit the created ads unit. Create ads units as many as you need to show on pages.

6- Now all the ads unit will be shown in the list in overview under Existing ads Unit. And now on the ads unit click on the Edit option and copy the code and paste on your html page  inside  <body></body> tag wherever you want to show the google ads.

NOTE:- It usually takes a few minutes for ads to appear on the page but occasionally it can take up to an hour. If ads still aren’t showing after an hour, check your site has a status of “ready” on your Sites page.

Leave a Reply

Your email address will not be published. Required fields are marked *