2012-01-21 14:48
浏览 56


I have tried multiple plug-ins for ads and for each page refresh they all count it as 3 impressions.

Any idea why this is happening or how to fix it?

Currently using the Ad Engine plugin, and already tried Simple Ads Manager. Using an Image.

Example Code:

                    <!doctype html>
<!-- -->
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!-- Consider adding an manifest.appcache: -->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
  <meta charset="utf-8">

  <!-- Use the .htaccess and remove these lines to avoid edge case issues.
       More info: -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <!--Wordpress Template-->
  <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>  
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />  

  <?php wp_head(); ?>

  <meta name="description" content="Saint Petersburg SociaBulls">
  <meta name="author" content="Austin Piazza">

  <!-- Mobile viewport optimized: -->
  <meta name="viewport" content="width=device-width,initial-scale=1">

  <!-- Place favicon.ico and apple-touch-icon.png in the root directory: -->

  <link rel="stylesheet" type="text/css" href="<?php bloginfo('wpurl'); ?>/wp-content/themes/sociabulls/js/jcar/skins/tango/skin.css" />

  <!-- CSS: implied media=all -->
  <!-- CSS concatenated and minified via ant build script-->
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen,projection" />  
  <!-- end CSS-->

  <!-- More ideas for your <head> here: -->

  <!-- All JavaScript at the bottom, except for Modernizr / Respond.
       Modernizr enables HTML5 elements & feature detects; Respond is a polyfill for min/max-width CSS3 Media Queries
       For optimal performance, use a custom Modernizr build: -->
  <script src="<?php bloginfo('wpurl'); ?>/wp-content/themes/sociabulls/js/libs/modernizr-2.0.6.min.js"></script>

  <!-- end scripts-->

  <script type="text/javascript">
jQuery(document).ready(function() {
        // Configuration goes here

  <link href='' rel='stylesheet' type='text/css'>

<body <?php body_class($class); ?>>

  <div class="wide" id="container">
    <header id="sticky" class="wide">
        <div class="center">
        <a href="#"><h1 id="logo" class="notext">St. Pete Sociabulls</h1></a>
        <ul id="nav">
            <?php wp_list_pages('title_li='); ?>

<div id="page">
<div id="top"><div id="city"></div></div>
<div id="main" role="main" class="wide">
    <div id="full">
        <div class="center">
            <div id="moveup">

                <div id="main-event">
                     <h2><?php the_title('');?></h2>
                     <?php if (have_posts()) : while (have_posts()) : the_post();?>
                     <div class="whole-post">

                         <div class="post-date">
                            <?php the_date( 'M d' ); ?>
                         <div class="entry">
                             <div class="entrytext">
                                  <?php the_content(); ?>
                   <?php endwhile; endif; ?>


                    <?php if ( !function_exists('dynamic_sidebar')  
        || !dynamic_sidebar( 'rightsidebar' ) ) : ?> 
<?php endif; ?> 

<div id="ad-box">
                    <?php if ( !function_exists('dynamic_sidebar')  
        || !dynamic_sidebar( 'Ads' ) ) : ?> 
<?php endif; ?> 



<footer class="wide">
         <div id="seawall">
            <div class="center">
                <div id="sponsors">
                    <?php if ( !function_exists('dynamic_sidebar')  
        || !dynamic_sidebar( 'extra' ) ) : ?>
 <p>This is the deafult sidebar, add some widgets to change it.</p>  
<?php endif; ?> 

                <div id="social-page">
                    <div class="fb-like-box" data-href="" data-width="350" data-height="170" data-show-faces="true" data-stream="false" data-header="false"></div>
  </div> <!--! end of #container -->

  <!-- JavaScript at the bottom for fast page loading -->

  <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
  <script src="//"></script>
  <script>window.jQuery || document.write('<script src="js/libs/jquery-1.6.2.min.js"><\/script>')</script>
  <script type="text/javascript" src="<?php bloginfo('wpurl'); ?>/wp-content/themes/sociabulls/js/jcar/lib/jquery.jcarousel.js"></script>

  <!-- scripts concatenated and minified via ant build script-->
  <script defer src="js/plugins.js"></script>
  <script defer src="js/script.js"></script>

  <div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); = id;
  js.src = "//";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); = id;
  js.src = "//";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

  <!-- Change UA-XXXXX-X to be your site's ID -->
    window._gaq = [['_setAccount','UAXXXXXXXX1'],['_trackPageview'],['_trackPageLoadTime']];
      load: ('https:' == location.protocol ? '//ssl' : '//www') + ''

  <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6. -->
  <!--[if lt IE 7 ]>
    <script src="//"></script>

  <?php wp_footer(); ?>  


Plugin Code:

Update: Added all my code together


  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douxuanjie2692 2012-01-22 04:28


    I can't believe this entire problem was from naming my widget area 'ads'...

    打赏 评论
  • dqdjfb2325 2012-01-21 23:07

    One thing to check:

    Does it happens with different themes? Case not, In what API hook is the plugin's counter hooked?

    Chances are that your template/theme is following a non standard pattern and causing a given hooker to be activated more than once per page load.

    In case the problem is being triggered by your theme, we are on a tricky situation to debug. Plugin API Hooks are a bit numerous and can be fired in many parts of the theme, take a look at this reference:

    Some approaches:

    If the plugin source code is not too large, you can take a look at it and look for use of hooks, than you can figure out where the repetition of events are happening.

    Compare your theme with the functional theme and see if you're doing some anti pattern. I would start for the header part, sidebar, and footer. The number of repetitions (3) can be a good tip too.

    Are you repeating a given piece of code 3 times in your theme? Does your post loop runs exactly 3 times?

    Theoretically the problem code could be anywhere, but give some attention to compare your header with the functional theme's header, it's one of the most critical parts of a theme.

    打赏 评论

相关推荐 更多相似问题