What is Karafka? Karafka is a microframework used to simplify Apache Kafka based Ruby applications development. Up until now there was only a sending library called Poseidon and its extension called Poseidon Cluster that could be used to work with Kafka clusters. Unfortunately there was no Sinatra “like” framework to rapidly develop message based applications. […]Read more at the source
Two weeks ago José Valim and I went to Erlang Factory San Francisco and we had a great time. Erlang Factory San Francisco is one of the biggest events in the Erlang community. One of the things that got me most excited about it was how many people were excited and talking about Elixir throughout … »Read more at the source
Last month our team went to Agile Trends, an event in São Paulo where discussions revolved mainly around Agility in software projects. Starting the event activities, Niels Pflaeging presented a keynote where he defends Agile alone is not sufficient to taking organizations to the Knowledge Era, and that deeper transformations are necessary for doing that. […]Read more at the source
This year’s RailsConf was held in Chicago, from April 22 to 25, and Plataformatec was there, as in previous years, and this time it was represented by George Guimarães, Lucas Mazza, Rafael França, and myself included. Even though I’ve attended the last 5 RubyConf / Rails Summit here in Brazil, this was my first time […]Read more at the source
To track an event with Google Analytics, you’d need to trigger something like:
pageTracker._trackEvent('Button', 'Click', 'Get in touch');
As you can see from our code earlier, in development, the
_trackPageview() and handle it appropriately.
This class works with the following logic:
- if google analytics is loaded, pass the parameters to the real
- if google analytics is NOT loaded, output the information to
console.log()for debugging purposes
And in our production environment, we can see that this was sent to Google Analytics.
We’re able to do this by initializing the GoogleAnalyticsProxy class and calling these functions through it. For example:
_gap = new GoogleAnalyticsProxy(); _gap._trackEvent('Video', 'Play', 'Homepage video'); _gap._trackEvent('Video', 'Pause', 'Homepage video'); _gap._trackEvent('Button', 'Click', 'Call to action X');
You’ll see that we’re just calling
pageTracker. We then replace all the instances of pageTracker (except where it is defined in the google analytics code block they provide you). You’ll find this located near the bottom of our
We now have
_gap available throughout our project and can call
_trackPageview() with it. Note: You can use any JS variable name that you want, _gap is just what I went with.