question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Introduced new AdSense Code to Improve the Ad performance

See original GitHub issue

Feature Description

Google AdSense recently introduced the new AdSense snippet schema to improve the Ad performance. A user on the support forum also reported this.

Auto ads code example:

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234" crossorigin="anonymous"</script>

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The web tag for AdSense should be updated accordingly:
    • The script src should include a new client={publisher-id} query parameter
    • The script tag should receive an added crossorigin="anonymous" attribute

Implementation Brief

  • Using includes/Modules/AdSense/Web_Tag.php
    • Update the render method to add the client URL parameter having $this->tag_id as value and add the crossorigin="anonymous" attribute to the script tag.

Test Coverage

  • No new tests to be added

Visual Regression Changes

  • N/A

QA Brief

  • Enable AdSense on a site and ensure it is placing the AdSense tag for you.
  • Check the source code for new markup (ctrl+u, ctrl+f and search for ''adsbygoogle.js?client=")

Changelog entry

  • Update AdSense tag code to improve Ad performance.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
wpdarrencommented, Aug 31, 2021

QA Update: ✅

  • Verified that when AdSense is activated, the tag is placed for you.
  • Verified the source code has the new markup adsbygoogle.js?client=
  • Verified the source code also includes the crossorigin="anonymous" attribute.

image

1reaction
eugene-manuilovcommented, Aug 11, 2021

@asvinb to me it seems like we just need to add ?client=ca-pub-... parameter to the src URL and crossorigin="anonymous" attribute to the script tag itself. Everything else should remain the same.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improving ad performance with the new AdSense code
July 19, 2021We recently launched a new version of the AdSense code. The new AdSense code allows AdSense to trigger optimization features ...
Read more >
New Adsense Code To Improve Ad Performance
This doesn't currently seem to be deployed on my sites using SiteKit. Any idea when this will be deployed, or do I have...
Read more >
Improving ad performance with the new AdSense code - Drupal
The new AdSense code allows AdSense to trigger optimization features earlier which can improve the performance of the ads on your site.
Read more >
New Faster Google AdSense Embed Code
Google has announced that is launched a new version of its AdSense code that improves ad performance. I assume that means it performs...
Read more >
Introducing the new and improved Auto ads
- No more messing with ad codes! Auto ads now work through any AdSense ad unit code, so using them on your existing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found