The Tracking add-on lets you keep track of the statistics of your ads. It counts your ads’ impressions and clicks and visualizes your ad setup’s range and potential in graphs and numbers.

Tracking with Advanced Ads shows you overviews and insights on the clicks and impressions of your ads. You can individually follow your ads’ outreach and optimize their performance based on statistics by day, month, or year.

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

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

ad tracking methods
Choose the right ad tracking method for your purpose

The ad tracking starts right after you activated the plugin. To disable the tracking, 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, Advanced Ads will track all ads. 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.

Default setting for impression and click tracking
Default settings

Click Settings

Below the general tracking methods, you can find the click tracking options when done with Advanced Ads and not Google Analytics.

Click tracking settings
Click tracking options

To enable click tracking, 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.

Tracking delayed ads (PopUps and Sticky ads)

To get correct statistics of ads that are not showing immediately, you can enable the setting for Delayed ads in the general settings of Advanced Ads.

  • go to Advanced Ads > Settings > Tracking and enable Delayed ads

The feature is useful to track ads that are displayed after a specific time or following certain user-actions when they become visible to the user instead of right away. 

It applies to ad units set up with our add-ons PopUp and Layer Ads and Sticky Ads. For example: if you set up a PopUp to show after the user scrolled, you can use the setting to track the impression only when that happens.

The reason to have an additional setting is the additional AJAX request needed for tracking delayed ads, which some servers might have performance problems with.

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 parameter box:

Ad tracking options

Ad tracking options:

  • default: uses the global setting (see above)
  • disabled: tracking is deactivated for this ad
  • impressions & clicks: will track both, impressions and clicks of this ad
  • impressions only: will track only ad impressions, no clicks
  • clicks only: will track only the clicks on this ad, 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.

Target URL setting

Once you entered the target URL, you have two options for tracking.

By default, Advanced Ads will wrap the entire ad content (without the placement wrapper) in a link element. This is the best solution for tracking image ads.

Keep in mind that some ad networks like Google AdSense might not work or even forbid this kind of additional tracking.

You can manually place the click tracking link in your ad using the attribute %link% 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)

Then paste the URL of the link you want to track in your ad unit’s URL field.

This procedure is commonly used for ads of the ad type “Plain Text and Code”.

Example: click tracking in a “Plain Text and Code” ad

Let’s say you get a code for an ad from a client. This code contains a link to an URL.

<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>
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 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. </a> </div>
Code language: HTML, XML (xml)

Advanced Ads will render your text link according to your settings specified in the field click-link base and track every click.

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

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.

You can find this setting in the Stats meta box of the ad edit screen.

Note: this only works with the tracking methods provided by Advanced Ads and not when using Google Analytics tracking.

Impression and click limits in Advanced Ads
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 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. So if you use cache-busting, it will switch to AJAX, if allowed.

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

Recalculate sums setting

The sums reset when you save the tracking settings.

Statistics

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 statistics graph

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 to create the link.

Ad Statistic options and shareable link
Public ad statistic options

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 your sites’ full ad stats 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 essential 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 Stats 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

Shortcode

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

[the_ad_impressions id="AD_ID"]

Exchange AD_ID with the ID of the ad.

Tracking Methods

Choosing the right tracking method can be crucial to your business, primarily if you sell ad space based on impressions. Each method has its 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 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 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 ad content’s impression is not tracked, even if he saw it.

Compared to ad networks’ statistics, the impressions you count with this tracking method are likely to be lower.

Note: If your site uses a caching plugin or setup, you have to choose this method.

Track using Google Analytics

This method moves the full 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. On the other hand, this method will not work for ads that display on pages or other resources that don’t use Analytics.

Export, optimize, reset and remove ad statistics

The statistics page also contains a link to the database management of the Tracking add-on. There, you can export, optimize, reset, or remove ad statistics.

Database Management of Advanced Ads
Open the database management to export, compress or remove your ad statistics

Note: All these options only work for stats made with Advanced Ads locally, 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

Other notes

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 AJAX, your server is still hit 100,000 times for that tracking call.

The following libraries or external resources are used:

  • http://jqplot.com/
  • http://code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css

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 visited URL’s query parameters to the target URL of the ad. You need to enable this feature through a filter hook before you can use it.

Example

  • A user visits: https://yoursite.com?ref=1.
  • He clicks on the ad target URL in the tracking settings: https://partnersite.com.
  • User lands on https://partnersite.com?ref=1

If your target URL setting also contains parameters, they merge with the visited site’s query parameters.

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

Troubleshooting

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