Coder Social home page Coder Social logo

newspack-ads's Introduction

Newspack Ads

semantic-release newspack-ads

A full suite of advertising functionality controls, allowing you to manage all ad placements and behaviors from within the WordPress admin. Connect to Google Ad Manager or Broadstreet for seamless inventory management, adjust load rules, and configure advanced programmatic practices such as header bidding – all with one click.

Some features include:

  • Two options for ad server connection (Google Ad Manager and Broadstreet)
  • Create and manage ad unit inventory
  • Place ads across the site by enabling global placements, or using Newspack Ad blocks where desired
  • Manage where and how often ads appear within content
  • Set a custom ad label
  • Control of lazy loading (for Google Ad Manager users)
  • Control of active-view refresh
  • Suppress ads based on tags or categories

Development

  • Run npm start to compile the JS files, and start file watcher.
  • Run npm run build to perform a single compilation run.
  • Run npm run release:archive to package a release. The archive will be created in release/newspack-ads.zip.

Reporting Security Issues

To disclose a security issue to our team, please submit a report via HackerOne here.

Contributing to Newspack

If you have a patch or have stumbled upon an issue with the Newspack plugin/theme, you can contribute this back to the code. Please read our contributor guidelines for more information on how you can do this.

Support or Questions

This repository is not suitable for support or general questions about Newspack. Please only use our issue trackers for bug reports and feature requests, following the contribution guidelines.

Support requests in issues on this repository will be closed on sight.

License

Newspack is licensed under GNU General Public License v2 (or later).

newspack-ads's People

Contributors

adamsilverstein avatar adekbadek avatar chickenn00dle avatar claudiulodro avatar dependabot[bot] avatar dkoo avatar jeffersonrabb avatar kkataria3010 avatar kmwilkerson avatar laurelfulford avatar leogermani avatar matticbot avatar miguelpeixe avatar philipjohn avatar semantic-release-bot avatar thomasguillot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

newspack-ads's Issues

Responsive ads not working on AMP

The current implementation to support responsive ads through multi-sized ad units for AMP is not valid markup.

return sprintf(
'<style>%s</style>%s',
implode( ' ', $styles ),
implode( ' ', $markup )
);

AMP does not allow <style /> to be inside <body />. The result is multiple ads being displayed for the same ad unit since the media queries that control which ad should be visible are sanitized by AMP.

Ads Push

Scoped

Unscoped

  • Obviate the need to switch to GAM UI for most tasks - a publisher should not have to leave Newspack UI (#194)
  • Create a sitewide ads template that can be activated with minimal effort (#210)
  • Direct-sold content (integrate w/ Listings, Sponsors)
  • Ad creative creation in Gutenberg

Optimize alignment CSS

Looking at one of our publisher site's excess CSS, I ran across the following styles:

.wp-block-newspack-blocks-wp-block-newspack-ads-blocks-ad-unit.aligncenter > div { margin-left: auto; margin-right: auto; }
.wp-block-newspack-blocks-wp-block-newspack-ads-blocks-ad-unit.aligncenter > div { margin-left: auto; margin-right: auto; }
.wp-block-newspack-blocks-wp-block-newspack-ads-blocks-ad-unit.aligncenter > div { margin-left: auto; margin-right: auto; }
.wp-block-newspack-blocks-wp-block-newspack-ads-blocks-ad-unit.aligncenter > div { margin-left: auto; margin-right: auto; }

While this alone isn't the full issue, it seems like a lot of CSS to be outputting, especially since it's writing it for every ad that's centered (or every ad on the page? I'm not sure) and AMP won't consolidate it even though it's the same thing.

Some possible solutions could include:

  1. Having one CSS file that's enqueued with this style.
  2. Introducing a shorter CSS class, similar to the .wpnbhp class we use for homepage posts block -- wp-block-newspack-blocks-wp-block-newspack-ads-blocks-ad-unit is a lot! .wpnbad maybe?
  3. Move the styles to the theme, and assume WP themes will handle it -- normally they all include styles for the .aligncenter class though in this case, the fact it's a non-standard format (centering the element inside of the class, instead of the element the class is on itself), that might not be great.

Pre-defined ad placements: make them filterable

Is your feature request related to a problem? Please describe.
The advertising wizard defines a set of pre-defined ad placements and a method to retrieve the array.

While the pre-defined set is well chosen and maps well to placements chosen by many publishers, most publishers could use a few custom placements that would cater to their individual needs. It would help if one could hook (add_filter) into placements data and be able to define these custom placements.

Describe the solution you'd like
Add filters (apply_filter) to the codebase so that placement data can be manipulated from other plugins and themes.

Describe alternatives you've considered
One way to achieve a similar effect currently is to register custom sidebars and use the provided Ad widget to assign ads to predefined placements this way. Being able to tap into the main ad association screen in Newspack would be much more seamless and intuitive, though.

Additional context
No additional context.

Option for ad label

Ad Label clearly differentiate ads from main content. Recommended to provide an option to customise ad label for all ad placements.

Global Settings: Remove WordAds and AdSense

Right now, both WordAds and AdSense appear in the options for Global Setting in the Ads Wizard if you have them enabled, but they can't be applied this way yet:

image

They should be hidden from this dropdown for the short-term, until they are completely hooked up.

Edited to add: the 'Configure' links should also be removed from next to these two options when you've enabled them, unless we can link WordAds' Configure link to Jetpack > Settings > Traffic (since you can refine ad placement from there for that option).

Google MCM support with connected/synced GAM accounts

#169 adds support for using GAM accounts by defining network codes as a comma-delimited list, as required by MCM. This works for the "legacy" Ads UI that doesn't connect to a GAM account directly.

However, with #124 and now #163, it's possible to connect a Newspack site to a single GAM account using either an OAuth app or a Google service account. These implementations assume that each site can only be connected to a single GAM account at a time. We should update the implementation to support connections to multiple GAM accounts, for example if a service account is authorized to connect to more than GAM account for MCM. This will probably also require some Ad wizard UI updates to group synced ad units by connected GAM account, if the site is synced to more than one account.

Google MCM support

Google MCM allows a "parent" GAM account to manage inventory for a "child" GAM account.

The ad code for this integration looks like this:

AMP:

<amp-ad width=970 height=250
    type="doubleclick"
    data-slot="/21759680430,1052128/70FM/MJL/MJL_leaderboard"
    data-multi-size="970x90,728x90,320x100,320x50,300x250">
</amp-ad>

non-AMP:

.defineSlot( '/21759680430,1052128/70FM/MJL/MJL_leaderboard', [[728, 90], [320, 100], [970, 250], [320, 50], [970, 90], [300, 250]], 'dfp-ad-leaderboard' )

Note in those codes that the format is GAMACCOUNT1,GAMACCOUNT2[...], so it appears that our existing code will work if we can support a comma in the GAM network ID field:

Screen Shot 2021-08-19 at 1 00 26 PM

Currently sanitizing prevents the comma. We should allow numeric values and a comma.

Ad Unit Widget: Add support for AdSense

It's currently only possible to add an AdSense unit in the pre-defined global placements. It is not possible to add AdSense ads via the Ad Unit widget, where only Google Ad Manager ads are exposed.

To get around this limitation, publishers need to have a Google Ad Manager account and an ad unit serving AdSense that they can then drop into their site using the Ad Unit widget. Using GAM is not easy for the average publisher and is a huge learning curve if they only want to serve AdSense (and not use Auto Ads).

Adding AdSense support to the Ad Unit widget would alleviate a lot of work for smaller publishers.

Broadstreet Integration

Originally filed in Automattic/newspack-plugin#508 by @philipjohn

Is your feature request related to a problem? Please describe.
When publishers use Broadstreet with Newspack it works well - the Broadstreet plugin connects fine and allows publishers to set up their ads using the widget and shortcode. However, there are global ad positions defined in the theme that are not available to publishers using Broadstreet.

Describe the solution you'd like
When a publisher using Broadstreet goes to Newspack > Advertising > Global Settings the "Ad Provider" drop down should include Broadstreet if the plugin is active and set up. Then, in the "Ad Unit" drop down, the available Broadstreet "Zones" should be available.

Ads fail to load leaving placeholder ad text - Newspack Ads + Ad Exchange

We are running a Newspack site with Ad Exchange ads served up via Google Ad Manager. Occasionally ad slots that usually receives ads are not served an ad. In this case, sometimes Newspack Ads will still render the slot as a blank placeholder, instead of hiding the ad altogether.

Screenshot 2021-01-15 at 08 22 29

Please advise.

Create keys in GAM

When the user connects GAM, automatically create keys for the default set of Newspack keys used: ID and category.

API reference for two required fields:
CustomTargetingKey.name for ID and category
CustomTargetingKey.type should be FREEFORM

Credential "network code" blocks editing

After uploading a GAM Service Account credential your UI gets stuck on "disabled editing" mode if you have an empty network code or a different code saved.

The UI should be updated to display the network code associated with the credential, using the same input but disabled. It should also display buttons to replace the credential and remove it, to return to legacy mode.

With this approach, Ad Units editing should never be disabled.

amp-sticky-ad not appearing

I have been unable to get the amp-sticky-ad to appear when using a 728x90 inventory slot on my Newspack installation using Google Ad Manager. I have successfully integrated Google Ad Manager with the site for other inventory slots both in widgets and in a global position, so I know GAM is working with NewsPack.

Steps to reproduce the issue

  1. create a 728x90 inventory slot in Google Ad Manager.
  2. Make an order with a line item that has a 728x90 creative and make sure it can flow into the inventory slot you created. optionally (and perhaps unnecessarily), set the Line Item Type to Sponsorship (4) to make sure it beats any ad networks that may be set up in Google Ad Manager
  3. Wait for a while because it can take Google Ad Manager some time to start delivering the ad.
  4. in Newspack>Advertising, configure Google Ad Manager with the right network code and add the ad unit there
  5. in Newspack>Advertising>Global Settings, turn on the Sticky ad, say that Google Ad Manager is the provider and choose the Ad unit you just set up
  6. Visit the amp version of an article on the website, and make the viewport narrow as if it were on a mobile phone

What I expected to happen

I expected to see a sticky ad at the bottom of the viewport. I also expected when viewing the source of the page that I would see <amp-sticky-ad> somewhere in the body of the HTML, but I didn't see that.

What actually happened

No sticky ad at the bottom of the viewport, no <amp-sticky-ad> in the HTML source

Details about environment (WordPress version, Newspack version, PHP version, etc.)

Wordpress 5.8.1, Newspack 1.56.0, Newspack Ads 1.16.0, PHP version 7.4.15 (Supports 64bit Values)
Theme versions: Newspack 1.46.0, Newspack Katharine 1.46.0 (I tried with and without Katharine and got the same result)
Plugins: AMP 2.1.4, W3 Total Cache 2.1.8 (but I turned it off and got the same result)

URL of the site experiencing the issue: https://outlookbythebay.com/ (you can get AMP versions of pages by adding ?amp=1 to the url)

Use multi-size ads for responsive AMP ads.

The responsive AMP ad handling renders an amp-ad element for each size and then hides/shows the appropriately-sized ad depending on the screen width. For a basic configuration with e.g. only two ad sizes 900x100 and 350x50, this works fine. For a more complex configuration with e.g. four ad sizes 900x100, 900x50, 350x100, 350x100, this approach does not work well. With such a configuration, the 900x50 and 350x50 ad sizes will never be displayed.

The markup for the above looks something like this:

<amp-ad width="900px" height="100px" ...></amp-ad>
<amp-ad width="900px" height="50px" ...></amp-ad>
<amp-ad width="350px" height="100px" ...></amp-ad>
<amp-ad width="350px" height="50px" ...></amp-ad>

A better approach for handling responsive AMP ads would be to add all sizes of the same width as multi-sizes on each ad. The updated markup would look something like this:

<amp-ad width="900px" height="100px" data-multi-size="900x100,900x50"...></amp-ad>
<amp-ad width="350px" height="100px" data-multi-size="350x100,350x50" ...></amp-ad>

Additionally, some sites use ads with different widths that should probably display at the same breakpoint. It probably makes sense to aggregate these sizes together if the widths are close. For example, if a site has 300x250 and 320x250, either one of those should be a valid size on mobile viewports.

"Generate from HTML code" feature

For Google Ad Manager ads we simplify the integration process somewhat by only requiring the ad unit code and sizes information, and our documentation helps people to extract that information.

One thing that could make this easier is to add mechanism, within the "add ad unit" screen to allow a user to generate the settings from a pasted-in HTML code. This could accept either the full HTML, or AMP tag version of the code provided by ad manager and parse that to get the required information out into the relevant fields.

This could be useful in cases where publishers don't have access to ad manager themselves for some reason, perhaps because they are using a 3rd party who has only provided them with HTML code.

Responsive AMP ad blocks

There should be responsive handling for the ad blocks in AMP mode. Currently there isn't, and the ad just gets cut off by the screen.

Restructure Size Options for Ad Units

Update ad unit setup page to encourage the use of standard IAB ad unit sizes. Rather than freeform width and height fields, have a dropdown (or other selection method) that lists the following sizes:

970x250
970x90
728x90
300x600
300x250
300x1050
160x600
320x50
320x100
120x60

In that selection, we can either allow them to select more than one size or keep the "add size" button the show another selection box.

There will be times when a custom size is needed, so include a checkbox for adding a "custom" size that opens the freeform width and height fields.

Provide a widget, as well as a block

While it's likely we can eventually just use blocks, at the moment widgets are needed to most effectively place ads.

To that end, we should add a widget with the same behaviour as the Ads block - providing a drop down box for the selection of a named Ad Unit as added in the Ads wizard.

Fatal errors on post if ad unit deleted

Screen Shot 2019-08-08 at 10 46 16 AM

There should be a check here for is_wp_error and graceful handling before using the ad unit.

To reproduce:

  1. Create an ad unit and add it to a post.
  2. Delete the ad unit. Go back to the post. Observe fatal error.

Add control of ads on archive pages

HKFP got a notice from Google that some ads providers were opting not to display ads on their tag page because of the content type. They'd like to be able to turn off ads for that page to clear the notice in GAM but there is currently no easy way to do that.

Could we add a filter to our ad manager that allows for removing ads on specific archive pages in the same way that we do for individual posts?

Instead of requiring pasted code, take ad names and dimensions

The plugin currently requires users to copy/paste ad code from Ad Manager. This can be a long process, and it's almost certainly a tedious process. When there is more than one ad (which is often) the global head code needs to be manually constructed from what GAM puts out for each individual ad - another long and tedious process.

Instead, it should be possible to ask for the following information only and construct ad code automagically:

  • Google Ad Manager Network Code - this is the numerical ID for the GAM publisher account
  • Ad Unit code - this is the machine-readable version of the "human" name for the ad unit, e.g. "banner_category_middle"
  • Ad dimensions - This is the dimensions (e.g. 728x90) to show at each device breakpoint, enabling different size ads to be shown at different screen sizes

The plugin can then provide a block and a widget (#14), each of which provides a drop-down box for selecting the ad to insert based on the Ad Unit Name.

To output, the plugin needs to determine if it's outputting AMP-compatible HTML or not and accordingly construct the code. See pamTN9-kv-p2

Google Ad Manager Network Code

This would replace the current Global Code setting in the Ads Wizard, and could look something like

Screenshot from 2020-01-08 14-18-41

Ad Unit code and Ad dimensions

This would replace the existing "Add/Edit Ad Unit" screen to ask for this information rather than HTML/AMP code. Something like this should work:

Screenshot from 2020-01-08 14-01-43

Remove slug key-val targeting

From @kmwilkerson at #78 (comment)

With the slug values, GAM limits it to 40 characters so those longer post titles will only be targetable within GAM using the first 40. For example, slug=programa-nc-hope-aun-acepta-solicitudes-de-ayuda-para-alquiler-con-servicio-en-espanol will have to be targeted as programa-nc-hope-aun-acepta-solicitudes- in GAM. Because of this, I think we should remove 'slug' as a targetable key so as not confuse publishers on why slug targeting doesn't work when they input the whole slug into the targeting picker. Using ID is the best way to go for single page/post targeting!

Ad selection issues in block

I noticed a few small issues when testing out the ad block:

1.

Ads without dimensions or with dimensions that don't parse don't look nice when the preview is rendered in the editor. It's probably best to have a nice min value for the preview dimensions. It'll be weird to manage pixel-based ad codes (ad codes with dimensions of 1x1 or no dimension) if there isn't a minimum on the preview. You may also want to display some sort of error notice in the block if the code doesn't look like a valid ad code (e.g. dimension parsing fails).

localhost_wp-admin_post php_post=1 action=edit (2)

To reproduce: Enter an invalid ad code for an ad unit.

2

If you only have one ad code, it's impossible to select it. Also, to select the first ad code you must first select a different ad code and then select the first ad code. If while fixing this, you really want the block to initialize with the "Select an ad unit" text instead of selected on the first ad code, I recommend making the first select option "Select an ad code" instead of the first code.

localhost_wp-admin_post php_post=1 action=edit (3)

To reproduce: Only have one ad code defined and try to select it.
To reproduce: Have multiple ad codes defined and try to select the first one in the select menu.

3

This isn't a technical issue, but it took me like 15 minutes of debugging to realize that the select dialogue is in the sidebar and not to expect a select dropdown in the block itself. The "Select an ad unit" text in the block really makes it seem like there should be a select right there. My suggestion is to either change the text to something like "Select an ad unit from the block settings in the sidebar" or have the select be within the block.

To reproduce: Erase all memories of using the block. Try and use the block. :)

4

There is no handling for when no ad units are defined. When no ad units exist, I recommend changing the text from "Select an ad unit" to something like "No ad units have been created yet. You can create ad units in the Ad Manager wizard".

To reproduce: Delete all your ad units and insert the block.

Link to an "advertising" page alongside ad units

When displaying ads, publishers may find it useful to provide an link alongside ad units. This could link to a page for two purposes:

  1. Explaining to readers why the ad is there, and the publisher's ad policy
  2. Informing potential advertisers of the opportunities available to them

This could be something that we just set in the Customiser, with the publisher providing the link text and choosing a page it should link to.

Can't see all ad units if >100 ad units

We have a list of Ad units that we need to use in our website. At some point, it seems that there is a limit to the list of units. If I add a new ad unit, the plugin "erase" one of the list. We looked up and if we erase one of the list, a previous "deleted" ad unit came back. The impact that we have, is when we are placing the ad unit in the content, the dropdown list only shows the visible ads in the admin, so we are missing some units for specific pages.

It seems that the limit to show are 100 items. Any idea of how to show the complete list of ad units added?

Add ad placement for in post

With other global positions available, in post ad placement will be a good option. Some of the ideas for implementation

  • Settings to display after every nth paragraph
  • Display wide ( Full width) ads for one column post Template (Changes in newspack theme might be required)
  • Ad Label

With lazy loading already implemented in this plugin, more many publishers it will also result in 1-2 less plugins and tight integration with overall newspack plugins and theme.

Allow attributes to be added to Doubleclick AMP ad units' markup

Currently, the AMP markup for doubleclick ad units has a firm structure that doesn't allow 3rd parties to change the generated markup (AFAIK, let me know if this is incorrect).

In our case we're running a native AMP site and would like to create a child theme and change the units' markup to potentially contain rtc-config and / or data-multi-size attributes to increase ad demand competition, but we're unable to easily do so.

Would it be possible to make the generated AMP ad unit string filterable? Or do you consider a filter like that to be too powerful and we should look for other options?

[ON HOLD] Support sticky sidebar ad units via blocks-based widget editor (WP 5.8)

WP 5.8 introduces the block widget editor. Our experimental feature to enable sticky sidebar ad units in the sidebar widget area no longer works with this editor because the widget method in class-newspack-ads-widget.php is no longer fired by blocks-based widgets in WP 5.8, therefore our stick-to-top class name is never added to the widget's container. The widget block editor also uses a different UI which doesn't show the "Stick to top" option at all.

The new widget block editor does provide a filter for the widget container's class names, but the filter doesn't really provide enough info about what's inside the widget to be useful for this. Could use some ideas on how we might bring this feature into the new widget editor.

Ideas:

  • Move "stick to top" to the ad unit's block attributes instead of in the widget. We'd still need to figure out a way to read the block's attributes from the widget block editor instance in order to know whether to add the class name.
  • Move "stick to top" to the widget area's editor sidebar instead of the widget item or block itself. Since each widget area can only contain one sticky element, this would let us define the sticky behavior on the widget area itself. I'm not sure yet if it's possible to actually add elements to this sidebar, though.

Screen Shot 2021-07-09 at 12 01 36 PM

Space allocated for ad doesn't match size of ad served

We are using Google Ad Manager with Ad Exchange to serve up ads on our Newspack site using Newspack-Ads. Very frequently, there is a mismatch between the space allocated for an ad and the size of the ad served.

For example, in our post sidebar, we support both 300x250 and 300x600 size ads. Frequently I see 300x250 ads within a 300x600 containing div created by Newspack ads. I have also observed the opposite, which causes the ad to be cut off and overlap other content. I have attached a screenshot illustrating an example of the issue.

Screenshot 2021-01-11 at 10 15 37

Screenshot 2021-01-11 at 10 24 57

The issue doesn't occur consistently, but enough to really impact the professionality of the site, and the efficacy of our advertising.

Orders, Line Items and Creatives

These GAM features should be integrated with our Ads wizard with the following:

Order

  • Order name (text input)
  • Advertiser (select input with registered Advertisers from GAM as options)
  • The trafficker will be automatically filled with the connected service account

Line Items

Once the order is saved, you will be able to create a new line item for it. Line items shall not be created outside of the order context.

  • Display only. We will not support video/audio line items.
  • Name (text input)
  • Item types (select input with trimmed down available options):
    Extra optional settings will not be used for this field
    • Sponsorship
    • Standard
    • Price priority
    • House
  • Delivery settings. Should work the same as GAM, following conditional changes based on the selected item type.
  • Targeting
    • Inventory: all or selected ad units.
    • Custom targeting: connect with posts/categories/tags/post type
    • Geography: connect with Google Maps API

Creatives

GAM requires a line item to have “expected creatives”, which is a list of sizes with optional custom targeting and other details on them.

We decided to reverse how this relationship works. The expected creatives will be registered automatically as the creatives are uploaded/created and associated with the line item. If the system can detect its size, the expected creative will be registered to the line item or the user will be prompted to fill it otherwise.

It will also be a simpler relationship since we will not currently support any of the optional details.

Supported creatives

  • Image (PNG, JPG, or GIF)
    • Name (text input)
    • File upload (file input)
    • Destination (text input)
  • Third-party
    • Name (text input)
    • Code (textarea)

Responsive Implementation For Units Placed In Content

The Responsive Ads work in #19 implements an approach where CSS media queries are used to control the visibility of different-sized ad units based on viewport width. This works well for units that occupy the full width of the page, typically banners placed above the header, below the header, or above the footer. This approach isn't appropriate for ads in sidebars or in the content column, because the media query will be based on the width of the viewport, not the width of the container in which the ads appear. Because of this, the responsive logic isn't applied to ad placements in widget areas, including those injected into content using Super Cool Ad Inserter.

This leads to problems for units placed in content. In the following screenshot, the ad unit supports sizes of 728x90 and 300x250. The expectation is that the 300x250 unit would be shown if the width of the content column falls below 728. However because the media query is based on viewport size, there's an area where the viewport is wider than 728 but the content column is narrower, and the ad unit overflows the container.

Screen Shot 2020-03-18 at 11 17 54 AM

Integrate SCAIP settings into ad wizard

The goal is to integrate the functionality/plugin settings of the SCAIP into our ad wizard.

  1. The fields that currently live under Settings > Ad Inserter should be moved to Newspack > Advertising > Global Settings
  2. Selection of what ad units should be injected in each placement currently lives in the widget settings making it a very disjointed experience. This should also be moved to Global Settings, as it would seamlessly fit the flow of options there.

[ON HOLD] Ad Unit Block: Add support for AdSense

It's currently only possible to add an AdSense unit in the pre-defined global placements. It is not possible to add AdSense ads via the Ad Unit block, where only Google Ad Manager ads are exposed.

To get around this limitation, publishers need to have a Google Ad Manager account and an ad unit serving AdSense that they can then drop into their site using the Ad Unit block. Using GAM is not easy for the average publisher and is a huge learning curve if they only want to serve AdSense (and not use Auto Ads).

Adding AdSense support to the Ad Unit block would alleviate a lot of work for smaller publishers.

Make all widget ad options global positions

I was surprised to have dropped an ad in the Above Copyright widget space and see it on the homepage as well.

Because all of the ones on the global position control are both pages and posts, it seems like this one should be there.

Use plugin functionality to hide ads on Sponsored Content

Right now we're working on a feature to allow posts to be marked as 'Sponsored Content' (either by being assigned a sponsored taxonomy, or by being assigned a specific sponsor). This option is being managed in a plugin that is currently under development.

Part of this will include either fully hiding ads on sponsored content (or adding an option in the Sponsored Content plugin).

Is it possible to either automatically toggle ads off on posts when they've been assigned a sponsored taxonomy, or a direct sponsor?

image

Responsive ads

We should follow the GAM guide to implementing responsive ads. I think this could be done in a fully automated way using the existing Ads wizard with no new UI needed: For each breakpoint, add the configured ad sizes that are smaller than it.

For example, if our mobile breakpoint is 780px, and our ad sizes are [[920,100],[320,100]], we would show both of those sizes on desktop and only the ones that fit on mobile e.g:

var mapping = googletag.sizeMapping()
  .addSize([780, 0],[[920,100],[320,100]])
  .addSize([0, 0], [[320,100]])
  .build();

There are a few other considerations, like not showing mobile ads on desktop, but this should at least prevent desktop ads from displaying on mobile.

Related to #50, some further discussion there.

Ads misaligned?

Issue raised here:

Automattic/newspack-theme#620

I tried Newspack-Ads plugin; it had one issue that the ads being inserted by the plugin were all left-aligned.

Creating an issue to investigate steps to reproduce, and fix!

Slashes are stripped from ad unit codes

Some ad unit codes will, legitimately, have slashes in them. Example:

AsiaTimes/Atimes_AMP/TopBanner

At present, these are stripped out when saving the individual ad unit so that the above becomes something like:

asiatimes-atimes_amp-topbanner

As you might expect, this causes the ad to fail on the front end.

The plugin needs to be a bit more relaxed about what it allows as the ad unit code.

Make global positions work with AdSense

While using pre-defined ad placements, ad units for adsense are not shown even after selecting Ad Sense as shown in below screenshot

Screen Shot

Site Kit is configured and request to /wp-json/newspack/v1/wizard/advertising/placement/global_above_header?_locale=user results in empty ad lists

{"services":{"wordads":{"label":"WordAds","enabled":false,"network_code":0,"upgrade_required":true},"google_ad_manager":{"label":"Google Ad Manager","enabled":"","network_code":0},"google_adsense":{"label":"Ad Sense","enabled":true,"network_code":0}},"placements":{"global_above_header":{"ad_unit":null,"enabled":true,"service":"google_adsense"},"global_below_header":{"ad_unit":"","enabled":false,"service":"google_adsense"},"global_above_footer":{"ad_unit":"","enabled":false,"service":"google_adsense"},"archives":{"ad_unit":"","enabled":false,"service":"google_adsense"},"search_results":{"ad_unit":"","enabled":false,"service":"google_adsense"},"sticky":{"ad_unit":"","enabled":false,"service":"google_adsense"}},"ad_units":[]}

Ad Settings: Expand 'hide ads' to include non-Newspack providers

Right now, the ads plugin includes a control to hide ads served up by a Newspack-linked service on specific posts and pages:

image

Is it possible to expand this to hide all ads, including ones from third-party providers (like Ezioc)? This would be extremely helpful in using this functionality to hide ads for Sponsored Content (related issue: #62).

Error: Unrecoverable Error

Immediately after installing Newspack ads, I got this error. (I am definitely not offline.)

Screenshot 2020-08-04 at 21 12 38

This error renders the ad plugin totally unusable.

Any insight into this issue?

Create inventory in GAM

Any ad units added in Newspack (after publisher has added Newspack as a service account in GAM) should be automatically pushed to GAM when the user clicks Save.

I recommend we only ask for "name", not "name" and "code", and set both fields as the same value when sending to GAM. I've yet to come across a publisher that has chosen to have different values for 'name' vs 'code'. We do not need to pass sizes, as it's an optional field in GAM and the publisher is likely to change the sizes quite often.

Creating an ad unit

  • parentId - this is a required field, but unique to each pub. We will need to first run a statement.query to get the AdUnit.parentId for the root ad unit and use the parentId found to push the new units.
  • name - use value user input into metafield
  • adUnitCode - same as name
  • targetWindow - always set to BLANK

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.