The Tracking add-on lets you keep track of the statistics of your ads. It counts your ads’ impressions and clicks and visualizes the range and potential of your ad setup in graphs and numbers.

Tracking with Advanced Ads shows you overviews and insights on the clicks and impressions of your ads. You can individually follow your ads’ outreach and optimize their performance based on statistics by day, month, or year.

This is the documentation of the Tracking add-on for Advanced Ads. It offers an overview of the features and functions of the plugin. You will also find links to additional in-depth articles and tutorials here.

Tracking Impressions and Clicks

After you installed and activated the add-on visit the Advanced Ads settings page. Choose the right tracking method for your purpose (see more information about the different tracking methods below).

Advanced Ads tracking methods
Choose the right ad tracking method for your purpose

The tracking starts right after you activated the plugin. To disable the ad tracking, simply deactivate the plugin.

Please note, that with Google Analytics tracking enabled, especially the local stats features mentioned on this page are not going to work since all numbers are only tracked in Analytics.

Find more information about each tracking method below.

Tracking all ads by default

By default, all ads are tracked. You can use the second global setting to disable tracking by default and enable it later for each ad individually. You can also specify the default setting there if you either want to track impressions or clicks only.

Tracking Settings Advanced Ads

Click Settings

Below the general tracking methods, you can find the click tracking options when done with Advanced Ads and not Google Analytics.

click settings

A unique URL is created to enable click tracking. This URL looks typically like However, you can change the “linkout” part to a string of your choice. You can use the chars “a-z” and “-“.

Please make sure, that this string does not collide with any posts or pages of the same name.

Tracking delayed ads (PopUps and sticky ads)

To get correct statistics of ads that are not shown immediately you can enable the setting for Delayed ads in the general settings of Advanced Ads.

  • go to Advanced Ads > Settings > Tracking and enable Delayed ads

The feature is useful to track ads that are displayed after a specific time or following certain user-actions when they become visible to the user instead of right away. This applies to ad units set up with our add-ons PopUp and Layer Ads and Sticky Ads. For example: if you set up a PopUp to show after the user scrolled, you can use the setting to track the impression only when that happens.

The reason to have an additional setting is the additional AJAX request needed for tracking delayed ads, which some servers might have performance problems with.

Ad based settings

Besides the general tracking options, you find some additional options on the ad edit page.

Tracking each ad individually

You can enable and disable tracking on a per-ad basis and enable the tracking of impressions or clicks only. Just visit the ad edit screen. You will find a new setting in the ad parameter box.

tracking of single ads

This is what the options mean:

  • default: the global setting is used (see above)
  • disabled: tracking is deactivated for this ad
  • impressions & clicks: both, impressions and clicks of this ad, will be tracked
  • impressions only: only the impressions of this ad will be tracked, no clicks
  • clicks only: only the clicks on this ad will be tracked, no impressions

Click target url

To enable click tracking, you must enter the target URL into the new URL field on the ad edit page.

click tracking target url

Once you entered the target URL, you have two options for the tracking.

By default, the entire ad content (without the placement wrapper) will be wrapped in a link element. This is the best solution for tracking image ads. Keep in mind that some ad networks like Google AdSense might not work or even forbid this kind of additional tracking.

You can place the click tracking link manually in your ad using the attribute %link% within the <a>-tag of your ad code. Your link might then look like this:

<a href="%link%" target="_blank">…</a>

Then simply type the URL of the link you want to track in your ad unit’s URL field. This is commonly used for ads of the ad type “Plain Text and Code”.

Example: click tracking in a “Plain Text and Code” ad

Let’s say, you get a code for an ad from a client. This code contains a link to an URL.

<div style="width: 728px; height: 90px; background: #428bca; text-align: center; vertical-align: middle; display: table-cell"> <a href="" style="color: #ffffff"> A simple example ad with a link to an external website. </a> </div>

In this example, we have a code for a div-container with blue background containing a text link in white color. Don’t bother with the style settings here. You have to concentrate on the <a>-tag in this code.

Create a new ad of the ad type “Plain Text and Code”. Copy the source code into the Ad Parameters” box and look for the <a href="">-part with the link. Replace the URL with %link%. Scroll down and type the original hyperlink into the URL-field.

<div style="width: 728px; height: 90px; background: #428bca; text-align: center; vertical-align: middle; display: table-cell"> <a href="%link%" style="color: #ffffff"> A simple example ad with a link to an external website. </a> </div>

Your text link will be rendered according to your settings specified in the field click-link base, and every click will be tracked.

Set your click track link manually by editing your ad code
Set your click target URL manually by editing your ad code

Limit ad views by impressions or clicks

The plugin also lets you limit the number of total impressions or clicks the ad can get before being disabled.

Note: this only works with the tracking methods provided by Advanced Ads and not when using Google Analytics tracking.

You can find this setting in the Stats meta box of the ad edit screen.

impression stats meta box

The table contains the impressions and clicks already made and allows you to set a total limit. If you leave the fields for the limit empty, then no limit will be set.

If you set an expiry date for the ad, the impressions and clicks will be spread over this period. You can switch off this behavior by setting the ADVANCED_ADS_TRACKING_NO_HOURLY_LIMIT constant in your wp-config.php. The limit might either not be reached or exceeded a bit, depending on how many impressions and clicks the ad finally receives. A cached ad might also cause more impressions, so if cache-busting is used, it will switch to AJAX, if allowed.

The sum is not updated with every ad impression to have a smaller impact on your site’s performance. To change the interval or deactivate it go to Advanced Ads > Settings > Tracking and change the value for Recalculate sums. The default value is 60 minutes.

recalculate sums setting

The sums reset when you save the tracking settings.


When you manage impressions and clicks with a local method and not Google Analytics, you can find your advertising statistics in your dashboard on Advanced Ads > Stats.

The page starts with some options to choose from.

Advanced Ads advertisement stats options

After you loaded the stats according to your choices, you will see a graph and a table with the impressions (blue) and clicks (orange).

ad stats graph

Public Stats

The Tracking add-on automatically creates non-indexed public pages with the stats for an individual ad. You can use this to quickly check your stats or even send it out to advertisers and clients.

You can find the link and settings in the Stats meta box on the ad edit screen. Resave the ad if you used a version prior to 1.2.8 to create the link.

public ad stats box

Email Reports

You can send reports with the combined stats for all ads on your site or individual stats for each ad via email.

Full report

Reports with the full ad stats of your sites can be sent out to one or multiple email addresses, while the first is used as the recipient. The others are set in BCC.

Find the settings in Advanced Ads > Settings > Tracking > Email Reports.

Among the essential settings are the Frequency (daily, weekly, monthly) and Period (last 30 days, last month, last 12 months).

Individual report

You can find the settings for ad specific reports in the Stats section of the ad edit screen.

The sender address will be taken from the settings made in Advanced Ads > Settings > Tracking > Email Reports.


You can use the following shortcode to display the number of impressions for an ad in the frontend:

[the_ad_impressions id="AD_ID"]

Exchange AD_ID with the id of the ad.

Tracking Methods

Choosing the right tracking method can be crucial to your business, primarily if you sell ad space based on impressions. Each method has its own advantages and disadvantages, so please read the following explanations carefully.

Some might want to compare the impressions to numbers that are provided by an ad network. Don’t be surprised if their and your numbers don’t match. I am also going to explain why.

Track on load

If you track ad impressions with the track on load method, the impression is counted when the ad output is sent to the browser.

This method might count impressions even though they never reached the browser or weren’t fully loaded. I.e., a visitor might close the window or click on a link before any of the output was loaded. The lower the ad in the code (e.g., in the footer), the more significant the difference between counted impressions and visible impressions of the ad.

If you compare the advertisement statistics measured like this with the numbers of an ad network, yours might be significantly higher. The call to their network happens after you loaded the ad tag from your database. Besides, some ad networks only count impressions when the content of the ad is fully loaded. Again, visitors might leave a page before this happens.

Even though impressions are not counted for bots by default, they can disguise themselves as normal desktop users and be tracked as well. With a lot of bot traffic, these numbers can be much higher than those with JavaScript-based tracking (see track with JavaScript (AJAX) below).

Track with JavaScript (AJAX)

This method counts the ad impressions after the frontend is fully loaded (using AJAX).

If a visitor leaves the current page before the complete frontend is loaded, including every piece of content, ads, and other scripts, the ad content’s impression is not tracked, even if he saw it.

Compared to statistics from ad networks, the impressions you count with this tracking method are likely to be lower.

If your site uses a caching plugin or setup, you have to choose this method. (see What is caching?)

Track using Google Analytics

This method moves the full tracking to Google Analytics if you are already using them for your website analytics.

You should use this method if you don’t want to have Tracking putting any weight on your server. On the other hand, this method will not work for ads that display on pages or other resources that don’t use Analytics.

Manual for Google Analytics tracking.

Other notes

When viewing the stats, the time offset you set for your blog on Settings > General > Timezone is used.

Local tracking methods cause a request on your server. Depending on your hosting package, this request might be billed by your server company even if you use an external cache like Cloudflare.

Example: Your site receives 100,000 monthly page impressions in total. 90,000 of them are delivered by Cloudflare and 10,000 by your server. If you are using impression tracking with a local tracking method like AJAX, your server is still hit 100,000 times for that tracking call.

The following libraries or external resources are used:


Export, optimize, reset and remove ad stats

The statistics page also contains a link to the database management of the Tracking add-on. There, you can export, optimize, reset, or remove ad stats.

Advanced Ads: reset your statistics
Open the database management to export, compress or remove your ad statistics

Please note, that all these options only work for stats made with Advanced Ads locally, but not if you are using the Google Analytics tracking.

Backup first

All the actions on this page will change your database. Please make sure that you have a recent backup of your tables, especially the tables ending with advads_impressions and advads_clicks.

Backups are created automatically by many hosting providers, but can also be managed manually using a backup plugin.

Export stats

export ad stats option

You can export your stats in the CSV format to work with them in another program like Excel or run your own scripts through them.

You can also export the stats to remove them afterward and then display them on the stats page when choosing file instead of database as the stats source.

Compress stats

Advanced Ads Tracking gives a warning if any table reaches 100.000 rows or more. While this is not really large, it might slow down your site or reach some limits on cheap hosting plans.

The plugin creates a row per hour and ad. A site with 10 active ads would, therefore, reach 87,600 rows within one year (365 days * 24 hours * 10 ads). Depending on the number of ads, you can achieve this number sooner or later.

The reason the tracking works per hour is that you can still change the time zone setting later and the stats will show for the correct date.

compress ad stats option

Compressing the stats combines all 24 rows for the hours of a day into one single row for the whole day with the time zone currently set on your site.

The compression doesn’t have any effect on the visible stats.

Remove old stats

As stated, this option allows you to completely remove old stats for a given period.

You can export your stats before removing them to later have access through the export file.

remove ad stats option

Reset Statistics

In this section, you can reset the impressions of individual or all ads.

reset ad stats options

Excluding bots

Bots and web crawlers might increase the number of impressions significantly. On non-cached sites, you can select the Hide ads from bots option to disable ads for bots.

Inherit query parameter

Advanced Ads Tracking can attach the query parameters of the visited URL to the target URL of the ad. This feature needs to be enabled through a filter hook.


User visits:, where he clicks on the ad Target URL in the tracking settings:

User lands on

If your Target URL setting also contains parameters, they merge with the query parameters from the visited site.

You can enable this feature through a filter hook, which allows you to control it per ad.

add_filter( 'advanced-ads-tracking-query-string', 'my_tracking_query_string', 10, 2 );
function my_tracking_query_string( $enabled, $ad_id ){
    // only ad 123 should inherit query strings of the visited URL
    if( 123 === $ad_id ) {
        return true;

    return $enabled;