This is the documentation of the Tracking add-on for Advanced Ads. It offers an overview of the features and functions of the plug-in. You will also find links to additional in-depth articles and tutorials here.

The Tracking add-on lets you keep track of the statistics of your ads. It counts the impressions and clicks of your ads and visualizes the range and potential of your ad setup 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 the outreach of your ads and optimize their performance based on statistics by day, month or year.

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

Advanced Ads tracking methods

The tracking starts right after you activated the plugin. To disable tracking, simply 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, all ads are tracked. 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.

Tracking Settings Advanced Ads

Click Settings

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

click settings

Click-link base

A unique url is created to enable click tracking. This url normally looks like http://example.com/linkout/123. However, you can change the “linkout” part to a string of your choice.

Note: for the click tracking to work you must have enabled a pretty permalink structure other than “default” in Settings > Permalinks in your WordPress Dashboard.

Tracking delayed ads (PopUps and sticky ads)

To get correct statistics of ads that are not shown 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. This 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

Beside 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 as well as you can enable the tracking of impressions or clicks only. Just visit the ad edit screen. You will find a new setting in the ad parameter box.

tracking of single ads

This is what the options mean:

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

click tracking target url

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

A) automatical link wrapping

By default, the whole ad content (without the placement wrapper) will be wrapped 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.

B) manually placed links

You can place the click tracking link manually 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>

Then simply type the URL of the link you want to track in the URL field in your ad unit. This 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>

In this example, we have a code for a div-container with blue background containing a text link in white color. 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 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>

Now your text link will be rendered according to your settings specified in the field click-link base and every click will be tracked.

Set your click track link manually by editing your ad code
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.

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

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

impression stats meta box

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, the impressions and clicks will be spread over this period. You can switch off this behavior by setting the ADVANCED_ADS_TRACKING_NO_HOURLY_LIMIT constant in your wp-config.php. Depending on how many impressions and clicks the ad receives at the end, the limit might either not be reached or exceeded a bit. A cached ad might also cause more impressions so if cache-busting is used, it will switch to AJAX, if allowed.

To have a smaller impact on your site’s performance, the sum is not updated with every ad impression. To change the interval or to 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 stats graph

Reset Statistics

The statistics page also contains a link to the database management of the Tracking add-on.

Advanced Ads: reset your statistics

In this section you can reset the impressions of individual or all ads. Aside from that, you can export, remove and compress your stats there too.

reset ad stats options

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

public ad stats box

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 the full ad stats of your sites 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 important settings are the Frequency (daily, weekly, monthly) and Period (last 30 days, last month, last 12 months).

Individual report

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

The sender address will be taken from the settings made in Advanced Ads > Settings > Tracking > 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 important to your business, especially if you sell ad space based on impressions. Each method has its own 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 bigger 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, because the call to their network happens after you loaded the ad tag from your database. In addition, 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 being tracked as well. With a lot of bot traffic, these numbers can be much higher than 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 impression of the ad content is not tracked, even if he saw it.

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

If your site uses a caching plugin or setup, you have to choose this method. (see What is caching?)

track after page printed

The tracking happens in the footer only, sending a single AJAX call to count all impressions at once. This saves on performance, but if the user aborts the loading of the page, some impressions might get lost.

track using Google Analytics

This method moves the whole tracking to Google Analytics if you are using them for your website analytics already.

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.

Manual for Google Analytics tracking.

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 are using impression tracking with a local tracking method like AJAX then 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 query parameters of the visited URL to the target URL of the ad. This feature needs to be enabled through a filter hook.

Example:

User visits: https://yoursite.com?ref=1, where 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 then they are merged with the query parameters from the visited site.

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