In this article we will highlight how to configure this piece of code in a Drupal website through extended module JS injector.
What is Google Auto Ads?
Google have launched Auto ads feature that offer a simple and innovative way for you to monetize your content. With Auto ads, you place one piece of code on all pages across your site. Auto ads will then scan your site and automatically place ads where they’re likely to perform well and potentially generate more revenue.
In this article we will highlight how to configure this JS snippet with Drupal website.
How Auto Ads Works?
Auto Ads is a smart technology from Google that will make it easier to search crawler to
Understand your page structure.
Detect any existing Google Ads in your pages
Automatically place new ads based on different elements such as your page layout, the volume of contents in your pages .
How to enable Google Auto Ads on Drupal site?
The strength of Drupal is its large library of modules that enables you from extending the functionality of your site.
In our case we want to look for a module that help us, namely JS injector.
What is JS injector module?
This module allows administrators to inject JS into the page output based on configurable rules. It's useful for adding simple JS tweaks without modifying a site's official theme - for example, a 'nighttime' color scheme could be added during certain hours. The JS is added using Drupal's standard function and respects page caching, etc.
How to implement Google Auto Ads using JS injector?
In the following points we will work through installing and configuring Auto ad feature in a given Drupal site.
Download JS injector module and extract it to your site modules folder.
Login to your admin page and enable this JS injector module.
When you done enabling JS injector module, navigate to the right of the module and click configure as in the figure below
Here we go, when you click configure a screen you need to click on Add link to add your JS snippet, in our case Google’s ad JS snippet like in the figure below:
You are done, now you have added Google’s Auto Code to your Drupal website.