Tracking impressions and clicks is one of the most used features within the Advanced Ads product family. There are a lot of factors that can influence the numbers. Tracking 2.0 is aiming to solve as many of these issues as possible automatically or with optimal default settings.

This page contains information about the changes and how you can get involved in testing them.

How to test Tracking 2.0

We intend to launch Tracking 2.0 with the most important changes regarding tracking reliability. It would help us a lot if users could install the beta version on new or staging sites and send us feedback, even if all is working as expected.

Please reach out to support to get the latest copy of Tracking 2.0.

We encourage users to install the latest version of Tracking 2.0 in any of the following cases:

  • You are setting up a completely new site
  • Your site is not reporting ad impressions to external parties, like advertisers and a sudden spike or drop in the measured impressions is not relevant to your business
  • You have a staging environment

How to install Tracking 2.0

All Access clients can download the latest release of Tracking 2.0 from a dedicated section in their account. If you purchased the Pro Bundle or Tracking individually, please reach out via our customer support to get a copy.

  • 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), but don’t delete the plugin
  • 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
  • if you replace Tracking 2.0 with a previous version then make sure to update the JavaScript file cache

Keeping the previous official release of Advanced Ads Tracking allows you to switch back to it in case you experience any serious issues. Please report them to us as well.

How to test

We are interested in learning if you see significant and unexpected changes after installing Tracking 2.0. So testing just means to install and activate the bet aversion we sent you and check if there is any error output or if your numbers change.

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 (previously: JavaScript (AJAX)) method and keep testing.

Enable the tracking debug option under Advanced Ads > Stats > Open database management > Debug mode so that significant changes can be identified later.

When comparing numbers with another 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.

You can also enable WP_DEBUG to catch any PHP-related errors if you see a critical error.

What do include in a bug report

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

If you see unexpected changes in tracking numbers then please include the tracking debug log file and 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

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
  • improved Frontend tracking method to use only a fraction of the previous time and performance and made it the default option for most users
  • 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 JavaScript tracking now work on AMP, too, and without the Responsive add-on as a requirement
  • the tracking debug file is more useful and consistent now
  • 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 PopUp 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.
  • 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. 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 “Limits” feature that allows you to set a limit of impressions and clicks and also 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 refreshes
  • we were able to make the local tracking methods work with infinite scroll, at least, with those methods that are not too customized

What to look out for

  • if you are using a tracking method other than Google Analytics then 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 to be 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 is a bit different
  • the new debug file name has the format advanced-ads-tracking-{URL}-{HASH}.csv

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

Our goal was always to find a default tracking method that solved all issues to never let users worry about it. It took years to brainstorm and the last six months to develop and test it since nothing like this existed before in any ad management plugin or related product. We tested a lot of methods and worked with a well-known hosting provider to decide on the path to go.

After a lot of testing and conversations with hosting providers, we were able to improve the existing JavaScript (AJAX) method which is now called Frontend. 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!). 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 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.

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

You can also switch to the still-existing Google Analytics tracking method to track and store ad impressions outside of your WordPress installation.

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 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 and the new Frontend method and no longer makes sense. If you had it enabled before Tracking 2.0 then you can still use it for a while. We are going to remove and switch users to the Frontend method at some point in the future.

Click Tracking

Click tracking uses JavaScript by default now. This should reduce the number of clicks performed by bots.

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

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.

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 example.com/some-super-affiliate-product/ became your-site.com/linkout/123. This happened for technical reasons. Even though we never advertised it like this, 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)

Debugging

Clicks that don’t use the %link% placeholder, explicit link cloaking, or Google Analytics tracking are now recorded through the new ajax-loader.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 tracking now also works on AMP pages.

Improvements to bot filter

The bot filter now also 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 Method => Frontend
  • Frontend Method + AJAX cache-busting is used => Frontend with AJAX Cache Busting
  • Frontend Method through admin-ajax.php => Frontend (Legacy)
  • Frontend Method + AMP => Frontend on AMP
  • Frontend Method + AMP + admin-ajax.php => Frontend on AMP (Legacy)
  • Database + AMP => Database on AMP
  • Database => Database

The file includes a new “Execution time” column that contains the time needed to write an impression into the database. This should help you to identify potential server issues. This time does not include the time that the request needs to be sent from your browser to 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.

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., PopUp ads that appear only after 2 seconds) only when they show up was removed. Delayed ads are now always tracked only when 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.

https://webmasters.googleblog.com/2019/09/evolving-nofollow-new-ways-to-identify.html?m=1

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 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' );
Code language: JavaScript (javascript)

Tracking Methods

After the official update, this section is going to replace the “Tracking Methods” section in our current Tracking Manual.

Tracking methods in Advanced Ads
FrontendGoogle AnalyticsDatabase
You should use this …When you don’t have a reason to switch to another method.When you want to compare ad performance with other analytics metrics.
When your server performance is too limited to handle Frontend tracking.
When you are technically experienced and deliver ads in a way where the other methods don’t work.
Note, that this method is used automatically when needed, like when serving ads through the ad server placement.
Data is storedIn your WordPress database.In your Google Analytics account.In your WordPress database.
Works on cached websitesYesYesOnly on uncached page impressions
When is the ad impression tracked?After the page was fully loaded or when an ad is delivered with a delay (e.g., popups).After the page was fully loaded or when an ad is delivered with a delay (e.g., popups).When the ad is requested from the database, which is before it is sent to the visitor’s browser.
Performance impact on the serverLittle on the server. We are using a custom and highly improved AJAX call.
The tracking call will show up as a network request in your browser.
No impact on the server.
The tracking call will show up as a network request in your browser.
Neglectible.
AMPWorksWorksWorks
Further informationManual for Google Analytics tracking

Tagged: