Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2010
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to get this to Report

    I have the folowing code running on my website http://www.rceno.com on the article pages, it supplies local hosted banner ads to the article pages that are linked to index.htmls (Information pages) for each sponsor....

    This is serving me well......

    But what I need is a way for this to report to me how often it has run or served a ad to the page, so i can report Impressions to my clients.... I can report how often the information page has been accessed for each client by my server stats, but not the impressions of the banners, so I thought that if the script could log the number of times it was run during the month I could pull those logs and report impressions to clients......

    Here is the code that is currently running.... It will Serve 300x250 Ads fading between them and place remaing ads in thumbnail fashion below......

    <script type="text/javascript" src="http://www.rockinghamcountymerchants.com/JQUERY/jquery-1.4.3.min.js"></script>
    <style type="text/css" media="screen">
    img{border:none}
    .adlink{position:relative;height:167px;width:300px;display:block}
    .adlink img{position:absolute}
    .active{z-index:2;}
    .next{z-index:1}
    #staticads img{width:90px;height:50px;float:left;border-right:2px;margin: 3px 4px 3px 4px;}
    </style>
    <img src="http://www.rockinghamcountymerchants.com/300x62Banners/186x19AdvertismentsBanner.png" alt="banner"><br />
    <script type="text/javascript">
    var ads = [
    ['http://www.rockinghamcountymerchants.com/AJsPitStop/300x167-AJsPitStop.jpg',
    'http://www.rockinghamcountymerchants.com/AJsPitStop/index.html'],
    ['http://www.rockinghamcountymerchants.com/AJsSweetShoppe/300x167-AJsSweetShoppe.jpg',
    'http://www.rockinghamcountymerchants.com/AJsSweetShoppe/index.html'],

    ['http://www.rockinghamcountymerchants.com/catsmeow/300x250CatsMeow.jpg',
    'http://www.rockinghamcountymerchants.com/catsmeow/index.html'],
    ['http://www.rockinghamcountymerchants.com/CittysPlumbing/CittysPlumbing300x250.jpg',
    'http://www.rockinghamcountymerchants.com/CittysPlumbing/CittysPlumbingREDIRECT.html'],
    ['http://www.rockinghamcountymerchants.com/cohenstearoom/300x167CohensTeaRoom.jpg',
    'http://www.rockinghamcountymerchants.com/cohenstearoom/index.html'],

    ['http://www.rockinghamcountymerchants.com/DavidPriceAutoWorks/300X250DavidPriceAutoWorks.jpg',
    'http://www.rockinghamcountymerchants.com/DavidPriceAutoWorks/index.html'],
    ['http://www.rockinghamcountymerchants.com/DebiJoyceConsulting/101810DebiJoyceAd.jpg',
    'http://www.rockinghamcountymerchants.com/DebiJoyceConsulting/index.html'],
    ['http://www.rockinghamcountymerchants.com/Diamonds-N-Dust/300x167-Diamonds-N-Dust.jpg',
    'http://www.rockinghamcountymerchants.com/Diamonds-N-Dust/index.html'],
    ['http://www.rockinghamcountymerchants.com/dyerssheetmetal/DyersSheetMetal-Jan811.jpg',
    'http://www.rockinghamcountymerchants.com/dyerssheetmetal/index.html'],

    ['http://www.rceno.com/RCENO/bannerads/elizabethspizza/elizabethspizza250x250.jpg',
    'http://www.rceno.com/RCENO/advertisers/elizabethspizza/index.html'],
    ['http://www.rockinghamcountymerchants.com/elizabeths-wentworth/300x167-ElizabethsWentworth.jpg',
    'http://www.rockinghamcountymerchants.com/elizabeths-wentworth/index.html'],
    ['http://www.rockinghamcountymerchants.com/everydayart/300x167EverydayArt.png',
    'http://www.rockinghamcountymerchants.com/everydayart/index.html'],

    ['http://www.rockinghamcountymerchants.com/fairfuneralhome/300x167FairsFuneral1.jpg',
    'http://www.rockinghamcountymerchants.com/fairfuneralhome/FairREDIRECT.html'],
    ['http://www.rockinghamcountymerchants.com/TheFrontPorch/300x167TheFrontPorch.jpg',
    'http://www.rockinghamcountymerchants.com/TheFrontPorch/index.html'],

    ['http://www.rockinghamcountymerchants.com/gavinsmightychamps/300x167GavinsMightyChamps.jpg',
    'http://www.rockinghamcountymerchants.com/gavinsmightychamps/gavinsmightychampsREDIRECT.html'],

    ['http://www.rockinghamcountymerchants.com/HolidayInnExpress/HolidayInnExpress300x250.jpg',
    'http://www.rockinghamcountymerchants.com/HolidayInnExpress/index.html'],

    ['http://www.rockinghamcountymerchants.com/Kameldas/kamelda300x167.jpg',
    'http://www.rockinghamcountymerchants.com/Kameldas/KameldasREDIRECT.html'],
    ['http://www.rceno.com/RCENO/bannerads/kingsway/300x250GoSeeAMovie.jpg',
    'http://www.rockinghamcountymerchants.com/kingsway4/'],

    ['http://www.rockinghamcountymerchants.com/MitchellsDiscountDrug/Mitchells300x167Sept14.jpg',
    'http://www.rockinghamcountymerchants.com/MitchellsDiscountDrug/index.html'],
    ['http://www.rockinghamcountymerchants.com/morethanyoga/300x167MTYFeb2011.jpg',
    'http://www.rockinghamcountymerchants.com/morethanyoga/MoreThanYogaREDIRECT.html'],

    ['http://www.rockinghamcountymerchants.com/pelhamtransportation/300x167PelhamTreeLightning.jpg',
    'http://www.rockinghamcountymerchants.com/pelhamtransportation/Redirect.html'],


    ['http://www.rockinghamcountymerchants.com/gwensinteriors/300x167-Nov11-Gwens.jpg',
    'http://www.rockinghamcountymerchants.com/gwensinteriors/index.html'],

    ['http://www.rockinghamcountymerchants.com/redrivergrill/300x167RedRiverGrill.jpg',
    'http://www.rockinghamcountymerchants.com/redrivergrill'],
    ['http://www.rockinghamcountymerchants.com/ReggieDenneyAuto/300x167ReggieDenney.jpg',
    'http://www.rockinghamcountymerchants.com/ReggieDenneyAuto/index.html'],
    ['http://www.rockinghamcountymerchants.com/eventcenter/300x250REC-RYD.jpg',
    'http://www.theexhibitcenter.com'],
    ['http://www.rockinghamcountymerchants.com/PP-RH-CC/300x167PP-RH-CCWeddingFair.jpg',
    'http://www.rockinghamcountymerchants.com/PP-RH-CC/index.html'],
    ['http://www.rockinghamcountymerchants.com/RubyRoseTeaRoom/300x167RubyRoseTeaRoom.jpg',
    'http://www.rockinghamcountymerchants.com/RubyRoseTeaRoom/index.html'],


    ['http://www.rockinghamcountymerchants.com/samplesandmore/300x167SamplesAndMore50Percent.jpg',
    'http://www.rockinghamcountymerchants.com/samplesandmore/index.html'],
    ['http://www.rockinghamcountymerchants.com/SeaSideMassage/300x167-Seaside-ValentineSpecial.jpg',
    'http://www.rockinghamcountymerchants.com/SeaSideMassage/index.html'],


    ['http://www.rockinghamcountymerchants.com/ArtOfBody-TaylorMade/300x167-ArtOfBody-TaylorMadeCombined.jpg',
    'http://www.rockinghamcountymerchants.com/ArtOfBody-TaylorMade/index.html'],
    ['http://www.rockinghamcountymerchants.com/TwoRiversPlaza/300x167-TwoRiversPlaza12-22-10.jpg',
    'http://www.rockinghamcountymerchants.com/TwoRiversPlaza/index.html']

    ];

    // preload the images:
    var adimages = [];
    for ( var i = 0; i < ads.length; ++i )
    {
    adimages[i] = new Image();
    adimages[i].src = ads[i][0];

    }

    var curad = 0;
    var lastad = null;

    var numberOfAdSpots = 4;
    var numberOfStaticAds = 31;

    // random re-ordering
    function scramble()
    {
    for ( var i = 0; i < ads.length; ++i )
    {
    var r = Math.floor( ads.length * Math.random() );
    var temp = ads[r];
    ads[r] = ads[i];
    ads[i] = temp;
    }
    if ( lastad == ads[0] )
    {
    ads[0] = ads[ads.length-1];
    ads[ads.length-1] = lastad;
    }
    }

    function getnextad( )
    {
    ad = ads[curad];
    ++ curad;
    if ( curad >= ads.length )
    {
    scramble();
    curad = 0;
    }
    lastad = ad;
    return ad;
    }

    function showNextSet( )
    {
    for ( var inum = 1; inum <= numberOfAdSpots; ++inum )
    {
    var link = $('#adlink' + inum);
    var ad = getnextad();
    link.attr('href',ad[1]);//set the href on the link
    link.find('.next').attr('src',ad[0]);//set new image to the src on the .next element
    link.find('.active').fadeOut(600,function(){//fade the top image out, and when the fade has completed
    $(this).siblings('.next').removeClass('next').addClass('active');
    $(this).removeClass('active').addClass('next').show();//swap the active/next classes on both images
    });
    }
    setTimeout( showNextSet, 8000 ); // 15 seconds between changes
    }
    onload=function(){
    $('.active').hide();
    scramble();
    for (var j=1;j<=numberOfStaticAds;++j)
    {
    var staticad = getnextad();
    $('#staticads').append('<a></a>');//append a link
    $('#staticads a:last').attr('href',staticad[1]).append('<img>');//add the href and append an image to the last link (which is the one created on the line above)
    $('#staticads a:last img').attr('src',staticad[0]);//add the src to the last link image, created above
    }
    showNextSet();
    }
    </script>
    <div>
    <a id="adlink1" class="adlink" href="" target="PopupAd">
    <img class="active" src="loading.gif" alt="ad" style="height: 167px; width: 300px;">
    <img class="next" src="loading.gif" alt="ad" style="height: 167px; width: 300px;">
    </a>
    </div>
    <br />
    <div>
    <a id="adlink2" class="adlink" href="" target="PopupAd">
    <img class="active" src="loading.gif" alt="ad" style="height: 167px; width: 300px;">
    <img class="next" src="loading.gif" alt="ad" style="height: 167px; width: 300px;">
    </a>
    </div>
    <br />
    <div id="staticads"></div>
    <div class="clear"></div>





    Thanks for Help and Suggestions

    -RCENO

  • #2
    New Coder
    Join Date
    Mar 2010
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I fund the following posted to the web, but not sure how to adapt to the above code......

    Did you know that you can track JavaScript events with Google Analytics? I just found this out... It's pretty cool, because allows you to track things like outbound link clicks, AJAX calls, static files, and more.

    It's quite simple to do, just call the urchinTracker function (make sure that your urchin code defined before and above calling this function), and pass in a url. It will then track log the url as if it were a regular page visit. So for example lets say you wanted to log downloads of a zip file...

    <a href="stuff.zip" onclick="urchinTracker('/downloads/stuff');"> download </a>You can use the same method to log a outbound link click...

    <a href="http://adobe.com/" onclick="urchinTracker('/outgoing/adobe_com');"> adobe </a>You should see /downloads/stuff and /outgoing/adobe_com in your reports within 24-48 hours.



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •