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.
Table of Contents
Ad tracking starts right after you activated the plugin.
You can define the general behavior of the plugin under Advanced Ads > Settings > Tracking.
The default “Frontend” tracking method is the best fit for most use cases. Choose “Google Analytics” if you want to outsource tracking numbers and performance to Google Analytics.
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.
Use the sponsored attribute to identify links on your site that were created as part of advertisements, sponsorships or other compensation agreements.https://webmasters.googleblog.com/2019/09/evolving-nofollow-new-ways-to-identify.html?m=1
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.
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 https://example.com/linkout/123. 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.
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 parameter box:
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. Advanced Ads detects clicks on the ad or manually placed link tags automatically. Use this method especially for ad networks like AdSense.
- Enter a target URL into the “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).
Manually placed links
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.
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
https://your-site.com to your partner’s URL on
https://example.com/some-super-affiliate-product/ looks like
Before using link-cloaking, you must enter the target link into the 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 URL field.
%link% as the value of the
href attribute within the
<a>-tag of your ad code. Your link might then look like this:
Code language: HTML, XML (xml)
<a href="%link%" target="_blank">…</a>
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' );
Example: link cloaking in a “Plain Text and Code” ad
Let’s say you receive a code for an ad from a client. This code contains a link to a URL.
Code language: HTML, XML (xml)
<div style="width: 728px; height: 90px; background: #428bca; text-align: center; vertical-align: middle; display: table-cell"> <a href="http://www.wpadvancedads.com" 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 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.
- 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.
Code language: HTML, XML (xml)
<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>
Advanced Ads will render your text link according to your settings specified in Advanced Ads > Settings > Tracking > Click-link base.
You can use
[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.
https://example.com/fancy-product/?ref-post=[POST_SLUG] into the URL field.
When the ad is placed on a single post page on your site, let’s say,
https://your-site.com/fancy-product-review/, 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.
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
The hourly pace is recalculated every hour to make sure 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 with 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 to choose from.
After you loaded the stats according to your choices, you will see a graph and a table with the impressions (blue) and clicks (orange).
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.
You can send reports with the combined stats for all ads on your site or each ad individually via email.
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).
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.
You can use the following shortcode to display the number of impressions for an ad in the frontend:
AD_ID with the ID of the ad.
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.
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, the impression is counted when the ad output is sent to the browser.
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.
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.
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
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.
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
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 use impression tracking with a local tracking method like Frontend, your server is still hit 100,000 times for that tracking call.
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.
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.
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:
- Set the tracking method to “Database”
- 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 10
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.