• pradg

    (@pradg)


    Hi,

    I am designing a new site using Gutenberg Blocks using 2024 or Spectra One theme. Trying to find information on how to add Google Adsense or other ad networks code on these websites but not finding any info. Majority of the tutorials are about how to add these code snippets into the header.php or body.php file on Classic themes.

    Can someone please guide me how to add adsense code on a Block theme website?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The AdSense page displaying the code will tell you: “Copy and paste the ad unit code in between the <body></body> tags of your pages”.

    How you do this depends more on your game plan for ad insertion, and very little to do with block vs classic themes. It’s the age-old strategy vs tactics.

    Wether block or classic theme, ideally, you want to use an ad management plugin to automatically inject different ad dimensions and formats at specific pre-defined (by you) spots your throughout your website.

    These plugins can even automatically inject ads in-between paragraphs on individual posts/pages. And as the codes for the ads are centrally managed in the plugin’s settings (and not scattered throughout the individual posts), it makes it easy to change these ads in the future.

    Google’s own Site Kit plugin can also insert AdSense code for you automatically. The major downside is that you have very little (if any) control over where ads are place. This limitation may not be an issue for you, but was definitely a deal-breaker for a client I recently worked with due to “aesthetic concerns”.

    If you want to manually insert ads into individual posts/pages, use a custom HTML block in the individual post/page. But I don’t recommend you do this, as this will quickly become a management nightmare, and you can’t manually insert ads into some sections of your site (eg in-between category/date/tag archive listings, above post title, etc) without custom coding.

    Good luck!

    Thread Starter pradg

    (@pradg)

    Thanks George.

    Let’s say I have created a page with a group with a specified width within which is all my content (paragraphs, featured image etc). I’d assume these ad inserter plugins can insert the ad code into the paragraphs etc within this group block. But let’s say I want ads to show outside this group on either side, can these plugins do that cos the page itself by design wont have any defined space to add any more blocks outside this group? That’s my main concern as I am new to this. Hopefully my query makes sense.

    Thanks.

    Let’s say I have created a page with a group with a specified width within which is all my content (paragraphs, featured image etc). I’d assume these ad inserter plugins can insert the ad code into the paragraphs etc within this group block.

    Sure. You can define rules like “place an ad after every X number of paragraphs”. Using paragraphs as a marker is just an example. Different plugins will have their own criteria.

    But let’s say I want ads to show outside this group on either side, can these plugins do that cos the page itself by design wont have any defined space to add any more blocks outside this group?

    I’m not sure what you mean by “group” in the context, but I’m supposing you mean outside the post/page content area: eg sidebar, header, footer, before post, after post, on archive pages, etc. If this is what you meant, I actually touched on this earlier when I said:

    … you can’t manually insert ads into some sections of your site (eg in-between category/date/tag archive listings, above post title, etc) without custom coding.

    So, yes, the plugins can do this automatically. You’ll just have to configure and define the ad zones where the plugin should display the ads. And you’ll likely need different AdSense codes (with different dimensions, unless you’re using autoads).

    But if you just want to Google to automatically decide where and when to show ads (and what ad sizes and formats to show), then just install and activate the Google Site Kit plugin, and connect it to your AdSense account. Google will take care of the rest.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.