This is the documentation of the Tracking add-on for Advanced Ads.

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

The tracking starts right after you activated the plugin. To disable 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 options for the click tracking, when done with Advanced Ads and not Google Analytics.

click settings

Click-link base

A unique url is created to enable click tracking. This url normally looks like However, you can change the “linkout” part to a string of your choice.

Note: for the click tracking to work you must have enabled a pretty permalink structure other than “default” in Settings > Permalinks in your WordPress Dashboard.

Ad based settings

Beside 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 as well as you can 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 urlOnce you entered the target url, you have two options for the tracking.

A) automatical link wrapping

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

B) manually placed links

You can place the click tracking link manually in your ad using %link% within your ad code. Your link might then look like this

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

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 boxThe 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. Depending on how many impressions and clicks the ad receives at the end, the limit might either not be reached or exceeded a bit. A cached ad might also cause more impressions so if cache-busting is used, it will switch to AJAX, if allowed.

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

recalculate sums settingThe 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

Reset Statistics

The statistics page also contains a link to the database management of the Tracking add-on.

Advanced Ads: reset your statistics

In this section you can reset the impressions of individual or all ads. Aside from that, you can export, remove and compress your stats there too.

reset ad stats options

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 in order 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 important 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:

Exchange AD_ID with the id of the ad.

Other notes

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

The following libraries or external ressources are used:



Tracking Methods

Choosing the right tracking method can be important to your business, especially 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 bigger 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, because the call to their network happens after you loaded the ad tag from your database. In addition, 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 being tracked as well. With a lot of bot traffic, these numbers can be much higher than 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 impression of the ad content 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 after page printed

The tracking happens in the footer only, sending a single AJAX call to count all impressions at once. This saves on performance, but if the user aborts the loading of the page, some impressions might get lost.

track using Google Analytics

This method moves the whole tracking to Google Analytics. Don’t use this method if you don’t have an account.

Manual for Google Analytics tracking.

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 then they are merged with the query parameters from the visited site.

You can enable this feature through a filter hook, which also 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;


 Add-On Manuals, Advanced Features