How to open an ad in a new window?

If you’re keen on retaining your site visitors while leading them to explore advertised offers, opening those ads in a new window or browser tab is the way to go. This is especially useful when you have multiple affiliate links and you want to ensure that a visitor clicking on one doesn’t get lost in the advertiser’s page wilderness.

This tutorial will walk you through making ads open in new tabs using Advanced Ads. The exact steps depend on the specific advertisement, and here’s where the Tracking add-on comes in handy. It simplifies the process and allows you to fine-tune how your ads behave. Let’s delve into the details and enhance your ad management skills!

Introducing the target attribute

The target attribute determines where the linked URL opens for link elements. When you designate the target as _blank, the URL typically opens in a new tab. Remember that users can customize their browser settings to have links open in a new window instead.

In the past, mitigating a general potential browser vulnerability required the addition of rel="noopener noreferrer" to the link. However, the landscape has evolved, and in nearly all modern browser versions, setting target="_blank" now inherently provides the same level of protection as rel="noopener". No longer is it necessary to explicitly include rel="noopener noreferrer" for contemporary browsers. This streamlining ensures a more straightforward and effective approach to safeguarding against potential vulnerabilities.

Open all ads in a new tab by default

If you want to, Advanced Ads effortlessly directs all ads—for which you can specify the URL in the provided field—to open in a new tab by default. This default behavior applies universally to ads falling under the Image ad type. Notably, the Tracking add-on extends this functionality to ads belonging to the Plain Text and Code and Rich Content ad types.

To enable this automatic opening of ads in a new tab, follow these steps:

  1. Navigate to Advanced Ads > Settings > General > Layout / Output.
  2. Once there, activate the “Open links in a new window” checkbox.
Option to open an ad in a new window
Navigate to the general settings to enable opening ads in a new window

Open individual ads in a new tab

If you’ve activated the Tracking add-on on your website, fine-tuning the behavior of whether ads should open in a new tab becomes even more precise. Head to the Ad Parameters section on the Ad Edit page, where you’ll find the Target Window function.

Option to open individual ads in a new tab
The Tracking add-on allows custom settings for individual ad units

 Initially, it’s set to “default,” aligning with the global setting you’ve configured in Advanced Ads > Settings > General > Layout / Output.

However, here’s where it gets interesting—you can customize this setting independently of the global configuration. This allows you to dictate whether the ad opens in a new tab or not with more granular control.

It’s essential to note that this function exclusively applies to the previously mentioned ad types, and there’s a caveat—a link must be specified in the URL target field. This restriction particularly impacts most JavaScript-based ad codes, where the option to set them to open in a new window separately might not be available. Keep this in mind as you fine-tune your ad settings.

Subscribe to our newsletter and get 2 add-ons for free!

* indicates required
Interests

How to customize specific ad types to open in a new tab 

Plain text and code ads

When utilizing the Plain Text and Code ad type, adding attributes to the link tag allows you to open the ad in a new tab.

For instance, consider the transformation from:

<a href="https://wpadvancedads.com">Anchor Text</a>

to

<a href="https://wpadvancedads.com" target="_blank">Anchor Text</a>

Adding the target="_blank" attribute signals your browser to open the link in a fresh browser tab or window.

It’s worth noting that modifying the code to trigger a new window isn’t universally applicable, especially for ad networks delivering ad code in JavaScript. For instance, popular networks like AdSense typically restrict the ability to make such modifications. Always be aware of the limitations imposed by specific ad networks when tweaking your ad code.

Rich content ads

Leveraging the Rich Content ad type provides you with versatile options for creating linked text. Simply highlight the text you want to link, and with a click on the link icon in the toolbar, a popup appears, allowing you to choose the link target URL. Notably, within this popup, the anchor text features a checkbox enabling you to opt for opening the link in a new window or tab.

New tab ad
The Rich content ad type allows adding the target attribute automatically

For those who prefer a more hands-on approach, you can seamlessly switch the rich content editor from visual to code. In doing so, you gain the ability to manually insert the “target” attribute, following the steps described earlier for opening the display in a new tab.

As mentioned above, it’s crucial to remember that when dealing with ad networks providing ad code in JavaScript, the flexibility to modify the code for a new window opening is often restricted.

AdSense ads

Typically, Google AdSense adheres to a policy disallowing Google ads from opening in new windows. However, exceptions exist in select markets, such as China, where opening ads in a new window aligns better with expected internet behavior, offering a more intuitive user experience.

Prioritizing user experience, Google strategically enables Google ads to open in new windows in regions where this aligns with anticipated browsing behavior. The user’s IP address determines this functionality and isn’t a configurable option within your AdSense account.

It’s important to note that Google strictly prohibits any modification of the AdSense ad code or altering the outcome of ad clicks on your website, as such actions violate program policies.

For those seeking a workaround to open AdSense ads in a new window, a viable option involves linking AdSense with Google Ad Manager. Further details on this workaround can be explored in the upcoming section.

Google Ad Manager ads

Connecting your AdSense account with Google Ad Manager and placing AdSense ads via this platform in parallel with other ads is possible. To integrate such ads into WordPress, I recommend our Google Ad Manager integration.

In Google Ad Manager, you can set a network-wide default behavior to open all ads on websites and apps in a new tab. This setting affects those AdSense units served via GAM, too. However, you can change the target behavior of individual ad units at any time.

Please check this article from the Google Ad Manager Help for more details. 

Google Ad Manager target window option
The Target window settings in Google Ad Manager

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.