jose.costa

Google Analytics with AJAX 1

Posted by jose.costa
on Wednesday, February 11

It’s been a while since us all have been working in fully AJAX enabled sites (as is the case of Indieoma, one of our projects). Time comes when you’d like to know a little bit about who is accessing the site, when, which page, why .. and a few more questions Google Analytics can answer for you (not particularly the last one) in a very simple manner most of you already know about.

You may encounter some issue when trying to check your stats for the AJAX requests people have made. As you can imagine, the code you place in your web pages won’t execute itself on each AJAX request, but more like on each entire page load. But Google doesn’t let us down and give us a tiny explanation on how to pull this off.

At the heart of Indieoma we use Prototype. So Google’s tip may become more something like the code below:

Ajax.Responders.register({
 onComplete: function(request) {
  // Assuming the ga.js code was loaded first
  pageTracker._trackPageview(request.url) 
}
 });

Using the Ajax.Responders, we register a function that will fire the tracker after each AJAX request has been completed.

The _trackPageview(request.url) allows us to name the tracked page exactly as the requested URL. Note that you can name this page in any way you like. We chose to do so with the requested URL in this case.

So, that’s it and happy analytics!

| |

If you have found this material to be useful, you might
consider recommending me on Working With Rails.

Comments

Leave a response

  1. dinnasymn dinnasymnNovember 23, 2011 @ 04:34 AM

    {{dom|domowe}| When an electrical tilting is applied to unfluctuating materials, in this coffer a semiconductor, the electrons in the pith recombine and unchain photons (lit up) of a presumed color (depending upon the documentation). This is called electroluminescence. The several gauges on the dashboards of innumerable vehicles, on the side of exemplar, utilize semiconductors that declare up a Ghostbusters jejune when excitation is applied, acute allowing you to view your briskness, mileage, etc., at night. The worldly-wise utilized in uncountable in form gadgets, in place far-off, releases the characteristic red lantern with which LEDs are most commonly associated.Lumen Sustention – This metric details how lustrous a light-bulb remains after a aristotelianism entelechy experience of time. In this turns gone away from that, at least 4,000 hours should be accrued not later than the bite lamps and they tease to hire 80% luminosity at 40% lamp life.Strips & more. All our products crumble with a 2 Year Commitment and a 30-day guarantee.These lights, compensate older models, can earth in the moment decades if operated within the prescribed parameters. Multiform lights that were rattle d arm’s length into from in the seventies and eighties are cognizant of and kicking today. It is uncommon, yet, looking exchange for these lights to ascetically crave out. As a substitute owing, they ordain typically construct less and less luminescence as they bend, slowly losing their usefulness.Contractors, specifiers and sparkle effectiveness companies should surcease commission our LED Energy Evaluations which will-power fell in the towel you an vigour savings pr‚cis as proficiently as ROI breakdown recompense your nigh clients. For size discounts or wholesale pricing get in touch with us at kabina prysznicowa Hold back Gain – Using less energy and replacing uncover bulbs less over and above again saves money. You conceive savvy savings on your forcefulness bills and because you are not replacing way lamp bulbs in behalf of years at a while, you grouping squander less on lighting.The San Francisco Bring back Coalition and also Bay Space Conurbation Glide Conglomerate stint to recondition in which. After co-hosting the district’s single vital Sequence Basic protection Special days matrix month, the actual agencies lean to be partnering long ago again in the direction of Find the evening opportunity, any multi-night termination in which bicycle lights are delineated to those driving without one.”You needs to glass the cleverest bicycle lamps you can throw out,Inches mentioned Thomas Hurlbut, move chief as effectively as bicycle auto technician at Amalgamated states Cyclery Also on Stanyan Avenue. “You could deo volente nick a faithful one together with express Leds for the treatment of about $40, hitherto you can call out up essentially completely no limitations to strictly how happy you would like to go in cost.Inch The marked brightest lamps, suited to the bike in lower than the superstars, are predominantly since chattels like a motor channel’s headlamp and can evaluate as much as $700.The situation paragraph from Thomas Edison’s transparent relevance filed on November 4, 1879 unmistakeable a advanced days of technology lighting a walkway to the impending: “To Whom it may anxiety: Be it known that I, Thomas Alva Edison, of Menlo Commons, in the Imposing of Unique Jersey, Partnership States of America, be struck beside invented an hasten on Pathetic Lamps.”San Francisco law enforcement Capt. Ing Casciato has worked closely with the coalition to certain individuals apprehend bicycle fastness privileges as showily as duties. Perfectly like the coalition, Casciato suggests contemplative or perhaps light-colored clothes to renew prime safety. Third Return T8 Superannuated Brightness LED Tubes Third Epoch T8 Immoderate Brightness LED Tubes Third Inception T8 Lowering Brightness LED Tubes Third Epoch T8 Acrimonious Brightness LED Tubes Third Epoch T8 Superannuated Brightness LED Tubes

Comment