Tracking 2.0

The release of Tracking 2.0 makes impression and click numbers more reliable. This includes a faster and more stable default method as well as solving edge cases where Tracking did not work before.

This page contains information about the changes, especially dedicated to existing users.

How to install Tracking 2.0

We are launching Tracking 2.0 in stages. First, the download links are updated so that everyone installing Tracking for the first time or downloading it again from their account, will use Tracking 2.0.

Everyone who has Tracking installed already will participate in a staged rollout. In the beginning, just 5% of our user base will see the updated version in their backend. We are going to increase that number constantly, depending on the feedback we receive. If everything works out as intended, Tracking 2.0 might be released to every user within a few weeks.

How to updates manually

When you don’t see the new version in your WordPress backend and want to test out Tracking on your live or staging site then you can do so by updating manually.

Just download the latest copy from the add-on list in your account and follow the next step.

  • Download the zip file
  • Go to the Plugins > Installed Plugins in your WordPress dashboard
  • Disable the currently installed version of Advanced Ads Tracking (no data will be lost).
  • Click on the Add New button at the top left of the page
  • Select the zip file you just downloaded and upload it
  • Activate the new version
  • Go to Advanced Ads > Settings > Tracking if you want to switch the tracking method
  • Refresh your site cache if you have one enabled
  • Update the JavaScript file cache on your site (if you use one) and in your browser

You can find the previous releases of Tracking in your account, too, in case you want or need to revert to an older version.

How to test

We are interested in learning if you see significant and unexpected changes after installing Tracking 2.0. So testing just means installing and activating the new version and check if there is any error output or if your numbers change significantly.

If you don’t see any changes with your current setup and you are using the Database (previously: Track on load) method, consider switching to the Frontend method and keep testing.

Enable the tracking debug option under Advanced Ads > Statistics > Open database management > Debug mode if you see larger changes and review the log to see when Advanced Ads tracks impressions and clicks.

When comparing numbers with other analytics (like Google Analytics page views), please always consider a full 24h starting at 0:00. Don’t count the day on which you made the switch.

What to include in a bug report

Please report any issues, possible misunderstanding, and even if you are missing information through our Tracking support form.

If you see unexpected changes in tracking numbers then please include the tracking debug log file and a description of why you believe the numbers should be higher or lower.

If you see a critical PHP error then please enable WP_DEBUG and send us the file after reproducing the error.

Summary of changes

  • The existing tracking methods have been improved and renamed
    • JavaScript (AJAX) is now Frontend and the default method for all new sites
    • On load is now Database
    • After page loaded completed is removed
    • Google Analytics is called the same
  • We improved Frontend tracking to use only a fraction of the previous performance. It is now the recommended tracking method.
  • The After page loaded completed tracking option was removed and can no longer be selected. It will still work if you selected it until now, but we recommend switching to Frontend instead
  • Google Analytics and Frontend tracking work on AMP. The Responsive add-on is no longer a requirement.
  • The tracking debug file is better readable
  • Bots that are known to execute JavaScript are filtered from impression tracking using the Frontend method
  • Delayed ads are now tracked when they appear (e.g., a pop-up showing only when the user scrolled the page)
  • Click tracking does work on JavaScript-based ads, like AdSense, as well. It detects manually added links in ad codes automatically. Instead of the /linkout URL, the normal target URL is showing in the frontend.
  • Added a Global option to mark links created by Advanced Ads as “sponsored”. You can change the option per ad as well.
  • We changed the handling of script files completely to only load those that are needed. This shouldn’t cause an issue, though you would need to update your browser and website’s file cache to see the changes
  • We have rewritten large parts of the feature that allows you to limit impressions and clicks for a given ad and spread them over a given time.
  • The performance of fetching stats in the backend was improved significantly so we removed caching them. This includes removing the “Recalculate Stats” option that defined how often the internal cache refreshed.
  • Local tracking methods work with infinite scroll when it is implemented using WordPress standards.

What to look out for

  • If you are using a tracking method other than Google Analytics then we recommend you change it to Frontend.
  • The default tracking method will only change to Frontend when you have not saved the Tracking settings before.
  • When you used the Frontend tracking method or cache-busting in Advanced Ads Pro, impressions might decrease due to our filter of JavaScript-executing bots. This is especially the case on sites using AdSense since the AdSense bot was also excluded from being counted.
  • When you used another local tracking method (not Google Analytics) on a cached website, switching to the Frontend will result in tracking more impressions, which is likely more accurate than the numbers you saw before that.
  • Switching to the Frontend method could also result in fewer impressions on uncached sites since it filters out most traffic from automated bots naturally, which is also more accurate than before.
  • If you are using AMP then your impressions might increase.
  • If you enabled the Tracking debug option, you might need to remove the log file and start a new one since the format and file name are different.
  • The new debug file name has the format advanced-ads-tracking-{URL}-{HASH}.csv.

Detailed changes in Tracking 2.0

Improved Frontend tracking is now the default method

Until now, the default tracking method counted an ad impression when the ad was loaded by the server. That technique could inflate ad impressions when sites had a lot of bot traffic or count too few impressions when sites were cached and didn’t use our cache-busting.

The previous JavaScript (AJAX) method reliably counted ad impressions from real visitors and excludes traffic that should not be counted at all. At the same time, it was using a lot of resources. This made it a risk to be used on servers with limited capacities or sites with very much traffic.

With the improved Frontend tracking, we found a default method that solved the mentioned issues. It took us some time since nothing like this existed before in any similar plugin. We tested a lot of methods and worked with a well-known hosting provider to fine-tune the code.

Depending on the number of other plugins installed and your hosting provider, the new method is reducing the tracking time down to 1% (no typo!) of similar calls on WordPress sites. The reliability and speed of this improved version make it a great default option for most websites.

Frontend tracking now also works on AMP pages. Previously, it fell back to the “on load” (Database) method which might have counted more bots.

Technical changes

If you are technically experienced then you might want to learn that instead of using admin-ajax.php for tracking impressions which included loading WordPress in the backend, we are now using a custom file hosted under wp-content/ajax-handler.php to store impressions. This file contains all the logic needed to store an impression directly in the database. In our tests, this file needed less than 10 ms from being called to store the impression. You should see an error if the file was not created automatically.

If you are concerned about the additional file directly storing impressions in your database then you can still set the ADVANCED_ADS_TRACKING_LEGACY_AJAX constant to true in your wp-config.php to fall back to using admin-ajax.php as before.

The hook advanced-ads-tracking-after-writing-into-db is not working with the new method. There might be a handful of users hooking into it who should consider changes. We removed that action entirely.

If needed, the custom tracking file is updated after changes in the backend. When you set a constant, e.g., ADVANCED_ADS_TRACKING_IGNORE_LOGGED_IN_USERS the change is only reflected after reloading WP admin once again.

Note for WP Engine customers: We saw a 301 redirect of our tracking call on AMP pages. This is what their support told us about it: The 301 should pose no issue as it appears the final request ends up being a 200. I suspect the 301 is showing here due to the security header ‘add_header Strict-Transport-Security “max-age=63072000; includeSubDomains; preload”;’ being used here, and pulling it off of the CDN just from looking into things here.

“After page loaded completed” deprecated

The After page load completed tracking method was a compromise between the previous default Database and the new Frontend method. If you had it enabled before Tracking 2.0 then you can still use it for a while. We are going to remove the code and automatically switch users to the Frontend method at some point in the future.

Click Tracking

Click tracking now works with any ad codes, including external codes that already contain a target URL, like AdSense and other networks.

The new default technology should also reduce the number of clicks triggered by bots.

Manually added links using the <a> tag in the code are detected automatically. It is no longer needed to place the %link% placeholder in the code. You can still do that if you only want to track clicks on specific links within the ad code.

For plain text and code ads, adding the target URL into the dedicated option is only needed if you are using the %link% or want to wrap the whole ad into a link.

If you have multiple links in your ad codes, you can disable automatic click tracking for individual links by adding class="notrack" to the <a> tag.

Ads on AMP and those served through the Ad Server placement still track clicks through the /linkout link. Click tracking on AMP does not work with the Google Analytics method as well as of ad types that have links included, e.g., AdSense or any JavaScript-based ads.

Clicks on a specific ad are only counted once every 10 seconds.

Link cloaking as a feature

The previous click tracking method demanded that links were changed by Advanced Ads. E.g., A link to your partner’s URL on became This happened for technical reasons. Even though we never advertised it, changing the links like this could also be perceived as a “link cloaking” feature.

If you put the %link% placeholder in your ad codes before then they will still use link cloaking. You can also enable link cloaking for ads with the target URL managed in Advanced Ads using the appropriate option on the ad edit page.

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

<code>add_filter( 'advanced-ads-ad-option-tracking.cloaking', '__return_true' );</code>Code language: HTML, XML (xml)


Clicks that don’t use the %link% placeholder, explicit link cloaking, or Google Analytics tracking are now recorded through the new ajax-handler.php file. You should see it in the Network tab in the browser’s developer tools. If the used Beacon API is not available in a browser, it uses admin-ajax.php.

Limited support for Database method

We renamed the previous default option Track on load to Database. We are only recommending it to users who know why they choose it and will limit support for it due to potentially inflated numbers. It is not a bad choice per se, but should only be selected if you understand the consequences.

Changes to “Google Analytics” tracking

Google Analytics impression tracking now works on AMP pages.

Improvements to bot filter

The bot filter now works on AMP pages. JavaScript-executing bots are also filtered out, if known to the plugin.

Tracking debug file

We have rewritten the tracking debug log file logic. Old files are no longer working and should be removed.

The new debug file name has the format advanced-ads-tracking-{URL}-{HASH}.csv.

The method used for tracking is easier to identify in the log now. Find the tracking methods and setups and the names we are using in the log below:

  • “Frontend” => Frontend method is used
  • “Frontend with AJAX Cache Busting” => Frontend method + AJAX cache-busting
  • “Frontend (Legacy)” => Frontend method through admin-ajax.php
  • “Frontend on AMP” => Frontend method on AMP pages
  • “Frontend on AMP (Legacy)” => Frontend method on AMP pages using admin-ajax.php
  • “Database” => Database method is used
  • “Database on AMP” => Database method on AMP pages

The “Execution time” column contains the time needed to write an impression into the database. This time does not include the latency that the request needs between your browser and the server, which can vary depending on the distance between both. The column would include n/a if the impression could not be written to the database. If the value exceeds 100 then you might want to upgrade your hosting package.

The default tracking debug period increased from 24 to 48 hours so that users can catch a full 24 hours starting at 0:00.

The ADVANCED_ADS_TRACKING_DEBUG constant, which you can set in wp-config.php to enable the debug mode for longer than 48 hours, now accepts 0 to disable the debug mode in WP Admin, 1 to enable it for all ads and an ad ID, e.g., 123 to enable it for a single ad only.

The debug mode option in WP admin overrides the setting of the ADVANCED_ADS_TRACKING_DEBUG constant. If you set the latter to 0 to disable debug mode, you can still enable it for 48 hours through the backend.

Limit impressions or clicks

We have rewritten the feature to limit the delivery of specific ads based on impressions or clicks. You can still set the expiry date of the ad to deliver them spread over a given time.

We improved the notices showing when the feature is used to make the behavior more clear and also extended the table with information about the impressions or clicks tracked in the given hour.

The limit is now also calculated dynamically and not based on a value that might be cached for 60 minutes. Ads that reach the limit are therefore disabled much sooner.

The limit is checked every minute. The hourly pace is recalculated every hour to make sure unfilled impressions are sold in time. We are also recalculating the pace when the ad options change.

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

One note about an edge case we haven’t solved:

If you set the constant ADVANCED_ADS_TRACKING_NO_HOURLY_LIMIT to disable the impressions or clicks spreading until the expiry date is reached, you need to save the ad with the options again to make it work.

Other changes

The constant ADVANCED_ADS_TRACKING_IGNORE_LOGGED_IN_USERS that removes tracking for logged-in users now must be set to true instead of having any value to work.

The option to track delayed ads (e.g., pop-up ads that appear after 2 seconds) was removed. Delayed ads are now always tracked the moment they appear.

We removed deprecated functions and code, including the (hidden) option to track events that happen on an external website.

We improved the time zone calculation to fix the wrong sending of reports after changes to summer time.

When Google Analytics tracking is enabled, options that cannot be used are hidden. E.g., email reports or database management.

We added an option to add rel="sponsored" to links generated by Advanced Ads. You can set a default behavior and change it on a per-ad basis.

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

We were able to make tracking of impressions using the Frontend or Database method work with the infinite scroll technology. This might still not work with very customized AJAX calls, though, and does not work when using the Google Analytics tracking method.

Preventing all scripts

We are aware that some users want to prevent any script output for tracking while keeping a basic impression and click-tracking enabled so we provided a way of doing that. 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 );Code language: JavaScript (javascript)

Tracking Methods

As mentioned above, we updated the tracking method names and improved their behavior.

Tracking methods in Advanced Ads

Please find further details about each method and lists of their behavior on the new Tracking Methods page.

Make it better

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