Tracking – Documentation

The Tracking add-on counts your ad impressions and clicks and allows you to view statistics and create reports.

In this manual, you will find an overview of the plugin’s features and functions as well as additional resources and tutorials.

General Settings

Ad tracking starts right after you activate the plugin.

You can define the general behavior of the plugin under Advanced Ads > Settings > Tracking.

The default “Frontend” tracking method best fits most use cases. Choose “Google Analytics” if you want to outsource tracking numbers and performance to Google Analytics.

Choose the ad tracking method

Please note that most of the following options are only available when you are not using the Google Analytics tracking method.

Find more information about each tracking method below.

What to track by default

By default, Advanced Ads will track all ads. You can use the global setting to disable tracking by default and enable it later for each ad individually.

You can also choose to track impressions or clicks only.

Impression and click tracking options in Advanced Ads
Enable only the tracking you need

Add “nofollow”

Enable this option to tell search engines not to follow links created by Advanced Ads. You can change your choice also on a per-ad basis. Please note that it only works for links managed by Advanced Ads. If the ad contains its own links, as Google AdSense or any other JavaScript-based ad does, then your choice might not be honored.

Add “sponsored”

Enable this option to tell search engines that links created by Advanced Ads are sponsored. You can change your choice also on a per-ad basis. Please note that it only works for links managed by Advanced Ads. If the ad contains its own links, as Google AdSense or any other JavaScript-based ad does, then your choice might not be honored.

Use the sponsored attribute to identify links on your site that were created as part of advertisements, sponsorships or other compensation agreements.

Link base for public reports

Choose the URL under which public reports are available. Each ad has its own report URL, which you can find on the ad edit screen.

Email reports

Find the options for email reports explained in the appropriate section below.

When using link cloaking, Advanced Ads creates a unique URL. 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 ensure that this string does not collide with any posts or pages of the same name.

The click-link base is used only when you set up ad links manually, as described below in the click tracking settings, or when JavaScript-based click tracking is not possible, like on AMP pages.

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 tracking impressions or clicks only. Just visit the ad edit screen. There, you will find a new setting in the Ad Parameters meta box:

Advanced tracking settings
Ad tracking options per ad unit

Click tracking and link cloaking

You have three options to set up click tracking for ads:

  • Do nothing if your ad code already contains a link or an iframe. Advanced Ads detects clicks on the ad or manually placed link tags automatically. Use this method, especially for ad networks like Google AdSense.
  • Enter a target URL into the Target URL field if the ad does not contain a link, e.g., image ads. Advanced Ads will automatically link the ad code to the target URL.
  • Place links manually (see below).
click tracking and link cloaking options of Advanced Ads
Click tracking and link cloaking options

When you are using <a> tags in your ad codes, Advanced Ads will automatically track clicks on these links, even if they only wrap some parts of your ad content.

You can add class="notrack" to the <a> tag to disable click tracking for specific links in your ad code, e.g., specific Call To Action elements or close buttons.

Link cloaking

Link cloaking means visitors see an arbitrary target URL in your website’s code and not the actual target link. E.g., A link from your site to your partner’s URL on looks like

Before using link-cloaking, you must enter the target link into the Target URL field and save the ad screen.

Now, you can enable link cloaking in two ways:

A) Enable the “Cloak your link” option that appeared below the Target URL field.

Link-cloaking option

B) Add %link% as the value of the href attribute within the <a>-tag of your ad code. Your link might then look like this:

<a href="%link%" target="_blank"></a>Code language: HTML, XML (xml)

You can use a filter to enable link cloaking for all suitable ads. This will also enable the option by default and make it read-only.

add_filter( 'advanced-ads-ad-option-tracking.cloaking', '__return_true' );Code language: JavaScript (javascript)

Let’s say you receive a code for an ad from a client. This code contains a link to a 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.
</div>Code language: HTML, XML (xml)

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

  1. Create a new ad of the ad type “Plain Text and Code”.
  2. Copy the source code into the Ad Parameters” box and look for the <a href=””> part with the link.
  3. Replace the URL with %link%.
  4. Scroll down and type the original hyperlink into the Target 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.
</div>Code language: HTML, XML (xml)

Advanced Ads will render your text link according to your settings specified in Advanced Ads > Settings > Tracking > Click-link base.

Adjusting an ad code for click tracking
Set your click target URL manually by editing your ad code

Link attributes

You can use [POST_ID][POST_SLUG][CAT_SLUG][AD_ID] in the URL to insert post ID, post slug, a comma-separated list of category slugs, the ID of the ad into the target URL. This allows you to tell the target website to analyze where the traffic is coming from.


You entered[POST_SLUG] into the Target URL field.

When the ad is placed on a single post page on your site, let’s say,, the ad will link to fancy-product-review is the slug from the linking post and will be different on other posts on your site.

When the placeholder doesn’t exist, e.g., [POST_SLUG] is empty when used on category pages outside of the content of posts, it will not be filled. So for the placeholders that contain formation from posts, you should make sure that the ads using them always appear on single pages or within the content of posts.

When using placeholders in the URL, the link is automatically cloaked (see Link Cloaking above).

Limit ad views by impressions or clicks

The Tracking add-on lets you limit the number of total impressions or clicks the ad can receive before being disabled.

You can find this setting in the Statistics meta box on the ad edit screen.

Note: this only works with the local tracking methods Frontend and Database, and not when using Google Analytics tracking.

limited ad impressions
Set impression and click limits

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, Advanced Ads will spread the impressions and clicks 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 hourly pace is recalculated every hour to ensure unused impressions are rolled over to the remaining time. The plugin also recalculates the pace when the ad options change.

The limit might either not be reached or exceeded slightly, depending on how many impressions and clicks the ad finally receives. A cached ad might also cause more impressions. The numbers are most exact when using AJAX Cache Busting, though this will put additional weight on your server performance.

When you enable the expiry option after impressions or clicks were already tracked for the current hour, and their number is higher than the newly calculated hourly limit, ads will resume within the next hour.


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 > Statistics.

The page starts with some options from which you can choose. These include selecting the reporting period and displaying the statistics by days, weeks, or months. Furthermore, you can compare the results in defined periods here.

Use the filter options to differentiate the results of either specific ads or groups.

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

Tracking statistics
Ad statistics

Public Stats

The Tracking add-on automatically creates non-indexed public pages with the statistics for an individual ad. You can use this to quickly check the numbers or share them with the advertiser.

You can find the link and settings in the Statistics meta box on the ad edit screen.

Public ad statistic options

Email Reports

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

Full report

Reports with your site’s complete ad statistics can be sent out to one or multiple email addresses, while the first is used as the recipient. The others are set to BCC.

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

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

Email report settings from Advanced Ads
You can automatically send reports to one or multiple email addresses

Individual report

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

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

Email report options
Options for individual email reports


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

[the_ad_impressions id="AD_ID"]
[the_ad_clicks id="AD_ID"]

Replace AD_ID with the ID of the ad.

Tracking Methods

Choosing the suitable tracking method can be crucial to your business, primarily if you sell ad space based on impressions.

Some publishers might want to compare the impressions to numbers that are provided by an ad network.

Each method has its advantages and disadvantages, so please read the following explanations carefully.

You can find more detailed information in the tracking methods documentation.


This method was formerly called JavaScript (AJAX). It is the default option since Tracking version 2.0.

We believe this method to be the best choice for most users in terms of performance and accuracy.

The Frontend tracking method counts ad impressions after the frontend of your website was fully loaded. It uses a single AJAX call for all ads directly loaded in the frontend and a single call for each ad loaded with a delay like ads in an automatically refreshing ad group or a pop-up.

Track using Google Analytics

This method moves 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.


If choosing the Database method, Advanced Ads counts the impression when the ad output is retrieved from the database by the server and sent to the browser. Since the Database method involves PHP, caching can break impression tracking. Chose the Frontend method, if you run any caching on your website.

On the other hand, this method might count impressions even though the ad was never fully loaded in the browser. 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. These numbers can be much higher with a lot of bot traffic than those with JavaScript-based tracking (see Frontend above).

Export, optimize, reset and remove ad statistics

Use the Database Management options to export, optimize, reset, or remove ad statistics.

You can find the link on the Statistics page or in the general Tracking settings.

Note: All these options only work for numbers tracked locally with Advanced Ads, but not if you are using 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.

Many hosting providers create backups automatically, but you can also manage them manually using a backup plugin.

Export ad statistics

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.

Remove old ad statistics

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

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

Reset ad statistics

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

Export, remove or reset ad statistics
You can export, remove or reset your ad statistics in the database options

Debug mode

Please find information on how to use the tracking debug mode on tracking issues.

Tracking on AMP pages

Tracking works on AMP pages with a few limitations to keep in mind:

  • Impression tracking only works when the page uses HTTPS
  • Click tracking only works when the target URL is managed by Advanced Ads (see link cloaking above) and never with the Google Analytics method
  • Since tracking cannot use JavaScript, the natural bot filter does not work, and unknown bots might not be filtered out. Use the Debug mode to identify those user agents. Let us know if you identify some that need to be added to the Advanced Ads bot list.

Other notes

Time zone

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

Server requests

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 use impression tracking with a local tracking method like Frontend, your server is still hit 100,000 times for that tracking call.

Click-tracking timeout

Clicks on a specific ad are only counted once every 10 seconds, except when link cloaking is used.

Ads in background tabs

If someone opens a page in the browser in a new tab without actively viewing it, then the tracking depends on the settings. Here, all three tracking methods behave identically.

If Cache Busting is enabled, such page views are not causing ad impressions. If Cache Busting is not used, such page views in the background tab trigger recorded ad impressions.

We have observed that clicks on ads opened in a new tab are not tracked under certain conditions. This happens, for example, when you right-click to open the context menu and open the ad in a new tab.

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. Though this should not be needed when using Frontend or Google Analytics tracking.

Google Analytics might still count bots. To entirely exclude them, you can check if their bot filter is enabled, which should be true to newer accounts. Go to Admin > [select a View] > View Settings and enable Bot Filtering in your Google Analytics account.

Bot Filtering option in Google Analytics
Bot filter option in Google Analytics

Preventing all scripts

Some users want to prevent any script output for tracking while keeping a basic impression, and click-tracking enabled. Please keep in mind that this setup might cause highly inaccurate tracking numbers, and we are not able to provide support for it.

To remove any trace of our Tracking scripts and codes in the frontend:

  1. Set the tracking method to “Database”
  2. Use the following filters:
add_filter( 'advanced-ads-ad-option-tracking.cloaking', '__return_true' );
add_filter( 'advanced-ads-tracking-load-header-scripts', '__return_false', 20 ); // the priority needs to be above 10Code language: JavaScript (javascript)


No, unfortunately, this is not possible. The sufficient condition for recording tracking data is that the add-on is enabled.

Since Advanced Ads uses an optimized AJAX call for tracking and not admin-ajax.php, the performance impact is not noticeable. Alternatively, you can connect the tracking with Google Analytics.

You can parallelly run a local tracking method and Google Analytics tracking. Find instructions on how to set this up here.

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

* indicates required


If you experience tracking problems or if the recorded statistics show discrepancies to your other statistics, you will find all known causes and solutions in our manual about tracking issues.

Make it better

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