{"id":808,"date":"2025-02-14T22:56:37","date_gmt":"2025-02-14T22:56:37","guid":{"rendered":"https:\/\/www.woodcentral.com\/-\/peter\/?p=808"},"modified":"2026-05-24T11:28:32","modified_gmt":"2026-05-24T11:28:32","slug":"tracking-ad-views","status":"publish","type":"post","link":"https:\/\/www.woodcentral.com\/-\/peter\/tracking-ad-views\/","title":{"rendered":"Tracking ad views"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Many websites and ad networks still rely on <strong>page views<\/strong> or <strong>hits<\/strong> to measure ad impressions, but these numbers don&#8217;t accurately reflect how many actual humans see an ad. Here\u2019s why:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Page Views vs. Ad Impressions<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A <strong>page view<\/strong> happens when a browser loads a webpage. But just because a page loads doesn\u2019t mean a person actually looks at the ad.<\/li>\n\n\n\n<li>An <strong>ad impression<\/strong> should ideally count when an ad is <strong>actually displayed in a visible area<\/strong> on a user\u2019s screen.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Common Issues That Inflate Impression Counts<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Bots &amp; Crawlers:<\/strong> Search engines and automated bots visit websites all the time, generating fake page views.<\/li>\n\n\n\n<li><strong>Multiple Ads Per Page:<\/strong> If a page has 10 ads, some systems count all 10 as &#8220;impressions,&#8221; even if they load off-screen where the user never sees them.<\/li>\n\n\n\n<li><strong>Fast Page Switching:<\/strong> Some users might quickly navigate through pages without actually looking at the content or ads.<\/li>\n\n\n\n<li><strong>Background Page Loads:<\/strong> Some websites refresh content in the background, loading ads without a user actively browsing.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Better Ways to Measure Real Views<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Viewability Tracking:<\/strong> Some ad platforms use technology to ensure an ad was actually visible for a certain amount of time before counting it.<\/li>\n\n\n\n<li><strong>Engagement Metrics:<\/strong> Clicks, scroll tracking, and mouse movement data can help determine if a real user actually saw an ad.<\/li>\n\n\n\n<li><strong>Unique Users Instead of Page Views:<\/strong> Counting unique visitors instead of just hits gives a better sense of how many real people saw the ad.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Why Some Sites Overbill Anyway<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Some sites (intentionally or not) still charge advertisers based on raw page views because it inflates the numbers.<\/li>\n\n\n\n<li>Less ethical publishers may include bot traffic to boost reported impressions.<\/li>\n\n\n\n<li>Some advertisers simply don\u2019t scrutinize the data closely enough.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Takeaway<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re paying for ad impressions, you should <strong>demand transparency<\/strong> from the site or network. Look for metrics that measure <strong>actual viewability, engagement, or unique human users<\/strong> instead of just raw page views.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Here\u2019s how you can improve accuracy:<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Log Only Visible Ad Impressions<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of counting every time a page loads, track when an ad <strong>actually appears on the user\u2019s screen.<\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>How to Do This:<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use <strong>JavaScript<\/strong> to detect when an ad enters the user\u2019s viewport (i.e., becomes visible).<\/li>\n\n\n\n<li>Only then log an impression to your file.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Example using JavaScript:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>document.addEventListener(\"DOMContentLoaded\", function () {\n    const ad = document.getElementById(\"ad-banner\"); \/\/ Select your ad element\n\n    const observer = new IntersectionObserver((entries) =&gt; {\n        entries.forEach(entry =&gt; {\n            if (entry.isIntersecting) {\n                fetch(\"\/track_ad.php?ad_id=12345\"); \/\/ Send log request when visible\n                observer.unobserve(ad); \/\/ Stop tracking after first view\n            }\n        });\n    }, { threshold: 0.5 }); \/\/ Triggers only if 50% of ad is visible\n\n    observer.observe(ad);\n});\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 This ensures the ad is <strong>at least 50% visible before logging it.<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Filter Out Bots &amp; Crawlers<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Most bots don\u2019t run JavaScript, so using a JavaScript-based tracking method helps.<br>But to be extra sure:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check the <strong>User-Agent<\/strong> of the visitor and filter out known bots.<\/li>\n\n\n\n<li>Look at behavior\u2014bots often request many pages very quickly.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You can add bot filtering in <strong>PHP<\/strong> when logging:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$userAgent = $_SERVER&#91;'HTTP_USER_AGENT'];\n$botKeywords = &#91;\"bot\", \"crawl\", \"spider\", \"fetch\", \"google\", \"yahoo\", \"bing\"];\n$isBot = false;\n\nforeach ($botKeywords as $bot) {\n    if (stripos($userAgent, $bot) !== false) {\n        $isBot = true;\n        break;\n    }\n}\n\nif (!$isBot) {\n    file_put_contents(\"ad_logs.txt\", \"Ad 12345 viewed by \" . $_SERVER&#91;'REMOTE_ADDR'] . \"\\n\", FILE_APPEND);\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 This <strong>prevents fake views<\/strong> from search engine crawlers and spam bots.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Track Unique Users Instead of Just Hits<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If the same user reloads the page 10 times, that shouldn&#8217;t count as 10 separate ad views.<br>You can track <strong>unique views per session<\/strong> using cookies:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>session_start();\n$adId = 12345;\n\nif (!isset($_SESSION&#91;\"ad_seen_$adId\"])) {\n    file_put_contents(\"ad_logs.txt\", \"Ad $adId viewed by \" . $_SERVER&#91;'REMOTE_ADDR'] . \"\\n\", FILE_APPEND);\n    $_SESSION&#91;\"ad_seen_$adId\"] = true; \/\/ Prevent duplicate counting\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 This <strong>stops inflated counts from refreshes.<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Log Clicks Separately from Views<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You already track clicks, but make sure it&#8217;s separate from impressions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (isset($_GET&#91;'ad_id'])) {\n    file_put_contents(\"click_logs.txt\", \"Ad \" . $_GET&#91;'ad_id'] . \" clicked by \" . $_SERVER&#91;'REMOTE_ADDR'] . \"\\n\", FILE_APPEND);\n    header(\"Location: https:\/\/advertiser-site.com\"); \/\/ Redirect to ad link\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u2705 This <strong>ensures click tracking stays independent from views.<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. Analyze Logs for Accuracy<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Look for spikes in views from the same IP.<\/strong> If one IP logs hundreds of views in minutes, it\u2019s likely automated.<\/li>\n\n\n\n<li><strong>Use user-agent filtering<\/strong> to block traffic from known bots.<\/li>\n\n\n\n<li><strong>Compare impressions to clicks.<\/strong> If an ad gets 10,000 views but only 2 clicks, you may have fake traffic.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Final Thoughts<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By using <strong>JavaScript for viewability tracking, bot filtering, and session-based unique views<\/strong>, you&#8217;ll ensure <strong>only real human users seeing the ad count as an impression.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many websites and ad networks still rely on page views or hits to measure ad impressions, but these numbers don&#8217;t accurately reflect how many actual humans see an ad. Here\u2019s why: 1. Page Views vs. Ad Impressions 2. Common Issues That Inflate Impression Counts 3. Better Ways to Measure Real Views 4. Why Some Sites &#8230; <a title=\"Tracking ad views\" class=\"read-more\" href=\"https:\/\/www.woodcentral.com\/-\/peter\/tracking-ad-views\/\" aria-label=\"Read more about Tracking ad views\">Read more<\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-808","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/posts\/808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/comments?post=808"}],"version-history":[{"count":0,"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/posts\/808\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/media?parent=808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/categories?post=808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/tags?post=808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}