Purchase OIOpublisher now for just $47.

Take control of your ad space.

Click here to purchase

    • CommentAuthoradecw
    • CommentTimeSep 23rd 2015 edited
     

    Hello, I'm trying to figure out if there is a way to automatically add Google Analytics onclick event tracking to all my banner links. I tried using a plugin (Yoast Analytics) but they said it was beyond the scope of the plugin due to the way the links are served, they are not recognized. I have tried both javascript and PHP versions of the OIO code. Ideally this would work for javascript since my banners won't rotate otherwise due to a caching plugin.

    Thanks so much for your help! Apologies for my lack of technical knowledge, I'm not even sure what's possible here.

    Edited to add: I use PrettyLink to hide my affiliate URLs, so all my banners are set up with a link like mysite.com/out/banner-ad that redirects to the affiliate link, so I'm looking to track clicks on those links, which are technically internal links.

    Need help?  Quick start guide | Troubleshooting | All help topics
    • CommentAuthorSimon
    • CommentTimeSep 27th 2015 edited
     
    Project Admin

    This is just a hunch, but it could be due to the fact OIO ads, when loaded using javascript, don't block the page loading - therefore "conventional" onclick handling using javascript may not catch them.

    Do you use jquery on your site? If so, here's a way you could ensure you always capture the onclick on an OIO banner ad link:

    <script>
    $(window).on('click', '.oio-banner-zone a', function(e) {
    //google analytics tracking goes here
    });
    </script>

    If you don't use jquery, I can put together a pure javascript version.

    Need help?  Quick start guide | Troubleshooting | All help topics
    • CommentAuthoradecw
    • CommentTimeSep 28th 2015
     

    Sorry, I don't know if the site is using jquery or not, I have a weird mish-mash of self-taught knowledge about this stuff and that is not included in the random facts I have picked up... this is the site, can you tell by taking a look?

    http://decoweddings.com

    And if it is, where would I put that code?

    Need help?  Quick start guide | Troubleshooting | All help topics
    • CommentAuthorSimon
    • CommentTimeOct 3rd 2015
     
    Project Admin

    It does look as though your site uses jquery. The code itself can technically go anywhere on the page, as long as it's after jquery. Putting it at the end of the page (e.g. in the footer, just above the </body> tag) would ensure it loads correctly.

    Need help?  Quick start guide | Troubleshooting | All help topics