How to override the Page Tracking value in Google Analytics

Analytics_iconI came across with an undocumented functionality on Google Classic Analytics (ga.js) snippet that allows to override the page tracking when you use “_gaq.push([‘_trackPageview’]);“.

Note: The ga.js snippet is part of Classic Analytics. If you’re using Universal Analytics (analytics.js) please check: Page Tracking – Web Tracking (analytics.js)

Tracking Code Quickstart

The Analytics snippet is a small piece of JavaScript code that you paste into your pages. It activates Google Analytics tracking by inserting ga.js into the page. To use this on your pages, copy the code snippet below, replacing UA-XXXXX-X with your web property ID. Paste this snippet into your website template page so that it appears before the closing </head> tag.

<script type="text/javascript">// <![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
// ]]></script>

To override the default page value, you can pass to the _gaq.push method an additional parameter, in this case, the custom path that you want to track:

_gaq.push(['_trackPageview', customPath]);

In the next image you can see the difference between the custom tracking page views code vs the default way.

google_analytics_custom_pathNote: The _gaq global object can be used directly for asynchronous page tracking via the push(…) method.

I really hope you find this information useful.

How view page-level custom variables in Google Analytics

Analytics_iconKudos to my colleague Carlos Hinojosa who discovered that to view a page-level custom variables in Google Analytics, you need to specify explicitly the metric and dimensions in a custom report. That is the reason why the default dashboard will not show page-level custom variables, yup, we get stuck for a while in this point!!.

Anyway, to create a custom report to see a page-level custom variable all you need to do is, in Google Analytics, under the Customization tab, click +New Custom Report and fill the next fields as follow:

Under Report Content section:

  • Metric Groups: Add PageViews option, is under Users group, to get the # of visits.

pageviews

  • Dimension Drilldowns: Add the desired custom variable, in our scenario, is the #4, then, since the purpose of the report is to get the values of the variable, you need to select as a nested dimension, the value of the selected custom variable.

custom_variable_valueIs recommended to add the custom report to a specific view, but is optional. Finally, the fields of your new report should looks like:

custom_reportClick on Save, and if all was selected correctly, the report should display the data, once is captured by Google anaylicits, of course, like the following screenshot:

custom_report_view

Tip: You can use: Google Analytics Debugger to check in real time if your custom variable is working and to not wait until the values ​​are reflected in the report.

This extension loads the debug version of the Google Analytics Javascript for all sites you browse using Google Chrome.  It prints useful information to the Javascript console. These messages include error messages and warnings which can tell you when your analytics tracking code is set up incorrectly.  In addition, it provides a detailed breakdown of each tracking beacon sent to Google Analytics.

Example

Google_Analytics_DebuggerNote: In our scenario we wanted to be sure that the custom variable # 4 be sent.

I really hope you find this information useful.

Intro to Agile Scrum in Under 10 Minutes – What is Scrum?

agileMy colleague Gerardo Chapa shared me a very nice introduction video to Agile Scrum in Under 10 Minutes, so, if you are looking to learn Scrum, this video is a great starting point to learn the basic concepts of this methodology.

I really hope you find this information useful.

How to get same results when sorting JavaScript arrays in all browsers

JavaScriptMy good friend Alex Arriaga has created an excellent post about how to get same results when sorting JavaScript arrays in all browsers, since recently one of our clients reported to us that they were seeing some data in different order depending of the browser used. Without doubt a very interesting case.

I really hope you find this information useful.

IBM Connections 4 API: How to Like a File Using jQuery Ajax

IBM Connections 4“IBM Connections is a social software platform that enables organizations to engage the right people, drive innovation, and deliver results”.

I have created a post on the Base22.com public knowledge wiki of How to like a File Using jQuery Ajax since there is no a link to IBM Connections 4 documentation.

This post is part of a current “How to” series that I have created, to check the complete list of posts, please check: IBM Connections 4 API How to

I really hope you find this information useful.

IBM Connections 4 API: How to Unlike a File Using jQuery Ajax

IBM Connections 4“IBM Connections is a social software platform that enables organizations to engage the right people, drive innovation, and deliver results”.

I have created a post on the Base22.com public knowledge wiki of How to Unlike a File Using jQuery Ajax since there is no a link to IBM Connections 4 documentation.

This post is part of a current “How to” series that I have created, to check the complete list of posts, please check: IBM Connections 4 API How to

I really hope you find this information useful.

IBM Connections 4 API: How to update a wiki page Using jQuery Ajax

IBM Connections 4“IBM Connections is a social software platform that enables organizations to engage the right people, drive innovation, and deliver results”.

I have created a post on the Base22.com public knowledge wiki of How to update a wiki page Using jQuery Ajax since the official IBM Connections 4.5 documentation is missing an important element.

This post is part of a current “How to” series that I have created, to check the complete list of posts, please check: IBM Connections 4 API How to

I really hope you find this information useful.

Using the JavaScript console API in a real scenario

JavaScriptIn this post I will share a real example of the use of the JavaScript console API beyond the traditional console.log( ) since it has an API that provides a number of methods that make debugging easier.

On Base22 we developed a set of assets, called xWidget Assets or just xWidget.

As an introduction, Base22 xWidget is set of beautiful, flexible, and easy to use templates for formatting the dynamic content that comes out of portal platforms and content management systems. Designed from the ground up to be dynamic, multilingual, and highly configurable directly by authors – xWidget can be deployed in any kind of environment and has been tested for user in IBM WebSphere Portal (versions 5, 6, 7, and 8) and SharePoint (2010, 2013).

In the developing process of the new version of the xWidget we wanted to make the debugging experience more easy and more useful, so, we incorporated the next list of methods that are part of the console API:

console.error(object [, object, …])

The console.error() method takes one or more objects and prints them to the console. This method is similar to console.log() however console.error() will also print a stack trace from where the method was called. The output will also be flagged as an error in the console.

console.groupCollapsed(object[, object, …])

The console.groupCollapsed() method is essentially the same as console.group() except that the group is initially displayed collapsed rather than open in the console.

console.info(object [, object, …])

The console.info() method functions in the same way as console.log() with the exception that log messages are given the info flag. This can be handy as the developer tools console has a feature that allows you to filter log messages using flags.

console.warn(object [, object, …])

The console.warn() method will log a message to the console with a warning flag.

Altogether:

Now, all the debug information is more easy to read and at the same time is more easy to identify potential problems thanks to the new way of we display all that info.console_log

console_log_1

Note: In order to support old browsers like IE 7, we added a polyfill in the code to support the use of the console object.

Similar posts:

Reference

I really hope you find this information useful.

IBM Connections 4 API: How to remove a tag from a Wiki Page Using jQuery Ajax

IBM Connections 4“IBM Connections is a social software platform that enables organizations to engage the right people, drive innovation, and deliver results”.

I have created a post on the Base22.com public knowledge wiki of How to remove a tag from a Wiki Page Using jQuery Ajax since I couldn’t find an example on the official IBM Connections 4 documentation.

This post is part of a current “How to” series that I have created, to check the complete list of posts, please check: IBM Connections 4 API How to

I really hope you find this information useful.

quote“I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain. ” — Frank Herbert