Giter VIP home page Giter VIP logo

beams_ads's Introduction

Beams Ads

A simple, open plugin to implement display of interstitial ads on a website. For a demo, visit http://pmckay.com/x/beams_ads/

Features

  • Built in jQuery v2.1.0.

  • Displays a responsive interstitial full-page ad upon initial site visit by a visitor to any page, then sets a cookie so as not to bug the user further.

  • Includes boilerplate Google Analytics code that can be customized to track ad views, ad click-throughs, and other events for ads on your site.

Usage

To implement the software's ad display features, first add the Beams Ads CSS and JavaScript files to your project. Then link to them in the header of any html page you want to show ads by adding links as follows:

<link rel="stylesheet" href="css/ads.css">
<script src="js/ads/jquery.interstitial.min.js" type="text/javascript"></script>
<script src="js/cookies/jquery.cookie.js" type="text/javascript"></script>

Then add the following statement somewhere on the html page, either in the the header or as an inline script in the body.

  if (!$.cookie('Ad_View')) {
    $().interstitial('open', {
      'url' : 'popup.html'
    }); 

    //Create a cookie
    
    $.cookie('Ad_View', '1', { path: '/' })

    };

###A quick tutorial on creating Google Analytics event trackers

As many sites monetize through advertising, we thought it was important to include some sort of analytics integration in the Beams Ads plugin.

Specifically, Google Analytics was the obvious candidate to start with considering how popular it is aroudn the web. This code snippet illustrates how the platform allow you to set up custom event trackers for ad clicks or similar events...

<a href=”” onClick=”_gaq.push(['_trackEvent', 'External Link', 'Twitter Link', 'Follow Us - Words']);”>Follow Us</a>

Where the labels used correlate to the following breakdowns in Google Analytics:

  • Category (required), Action (Required), Label 1 (Optional), Label 2 (Optional, not included in example)

  • With all this in mind, here are a few sample tracking scripts that would work with the Beams Ads plugin...

An event to track clicks on the "close link" for the interstitial would look like this:

<a href=”tktktk” onClick=”_gaq.push(['_trackEvent', 'Sponsorships', 'Interstitial Closed', 'Sponsor1']);”>Follow Us</a>

An event to track a clickthrough on a sponsor link:

<a href=”tktktk” onClick=”_gaq.push(['_trackEvent', 'Sponsorships', 'Sponsor Link Clickthrough', 'Sponsor1']);”>Follow Us</a>

You'll see sample trackers on the demo html pages we've included in Beams Ads. For a more detailed explainer about event tracking, I'd recommend the blog post at http://www.koozai.com/blog/analytics/how-to-track-clicks-on-a-link-in-google-analytics-7721/

A few other pointers

Main function of the included CSS file is to make ad display responsive across different-sized screens. But it's very minimal otherwise, leaving a lot of flexibility to customize ads for your sponsors' particular needs.

Beams Ads was originally written for inclusion in Roscoe Labs' open, full-stack Beams framework for independent web publishing. Hence the name Beams Ads.

Ad features are no longer officially supported by Roscoe Labs in the main Beams project, but Beams Ads code lives on as its own thing here.

Beams Ads is (and always will be) free to use under MIT license.

Finally, I must tip my hat to Brett DeWoody (http://github.com/brettdewoody) and Klaus Hartl (https://github.com/carhartl), whose previous open-source work on interstitials and cookies respective provided much of the foundation for this plugin. Essentially, I mashed up those two guys' projects, then added in responsive design and Google tracking of my own.

Cheers,

Peter McKay
Co-Founder/Chief Product Officer
Roscoe Labs

beams_ads's People

Stargazers

Roman avatar Daniel Reyes avatar Peter A. McKay avatar

Watchers

James Cloos avatar Peter A. McKay avatar  avatar

Forkers

masterxyu

beams_ads's Issues

Add support for Piwik event tracking, analytics as well

Piwik is an open analytics platform -- the sort of thing I'd like to support as a fellow open-source project.

Google Analytics is cool, certainly something a lot of sites are using, so it made sense to include in early version of Beams Ads. But I think users should at least have the choice of Piwik too, if they want.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.