Get Blogged by JoKi

"The only frontiers are in your mind"
10 | 03 | 2010
Navigation
Syndication
feed-image RSS 2.0
Most Read Articles
Related Resources
Article Time Line
Visitors
Validation

Valid XHTML 1.0 Transitional
Valid CSS!

Spacer for layout formatting
AddThis and Google Analytics : Asynchronous Tracking Code Integration PDF
User Rating: / 1
PoorBest 
Community
Wednesday, 03 March 2010 12:41

During the weekend I did some modifications, read improvements, here on the website according to Search Engine Optimization (SEO), keywords and page load times. Reducing the page load times made it necessarily to arrange my Javascript snippets in the template. So far, everything went well, until I figured out that my Google Analytics dropped down to 0...

So, while checking those issues I stumbled upon the 'new' Google Analytics Asynchronous Tracking code. This will also reduce page load time as "asynchronous tracking optimizes how browsers load ga.js so its impact on user experience is minimized." - Great!

The steps to use the asynchronous tracking is straight forward:

  • Memorize or copy your web property ID from the existing snippet
  • Remove the synchronous tracking code
  • Insert the asynchronous tracking code
    <script type="text/javascript"><!--
    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';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
    })();
    // --></script>
  • Replacing UA-XXXXX-X with your web property ID.

That's the easy part...

Integrating AddThis into the 'standard' Google Analytics is extensively described on the help pages of AddThis. But sadly, there is no information about the asynchronous tracking code. Additionally, I checked the AddThis support forum and the topic 'Google Analytics : Asynchronous Tracking Code Integration' is discussed since a while. Not even answered by AddThis supporters yet. Even the Google Forum does not provide an answer. I was astonished to see this! Frankly speaking, this is not an unusual situation for a website, or?

Anyways, back to this article. You can send AddThis shares to your Google Analytics reports as custom events in the category “addthis” by adding the following configuration code to your existing AddThis sharing code:

addthis_config = {
data_ga_tracker
: pageTracker
}

The main problem about the interoperability between AddThis and Google Analytics is that the asynchronous tracking code does not provide a pageTracker object anymore. As said, this only works with the synchronous tracking code of Google Analytics. The forum threads actually provides some directions towards the solution of this problem. The link between those two services is to reference the GA pageTracker object in the AddThis configuration.

The Asynchronous Tracking Usage Guide provides the necessary information in the paragraphs about Multiple Tracker Objects and Pushing Functions. It is not clearly described on the spot but with a little bit of logic you can figure it out: Create your own Javascript variable that queries the Google API.

_gaq.push(function() {
var pageTracker = _gaq._getAsyncTracker('myTracker');
var link = document.getElementById('my-link-id');
link
.href = pageTracker._getLinkerUrl('http://example.com/');
});
<

The solution lies in the parameter of _getAsyncTracker(). The samples in the User Guide refer to a named tracker. But what about the initial one? Right, just specify an empty string and you are done!

To summarize this article just use the following code snippet at the very end of your website to integrate Google Analytics : Asynchronous Tracking with your AddThis analytics:

<!-- Google Analytics and AddThis button -->
<script type="text/javascript">
(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';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
</script>

<script type="text/javascript">
var pageTracker = _gaq._getAsyncTracker('');
var addthis_config = {
data_ga_tracker: pageTracker
};</script>
</body>

The GA user guide recommends to split your asynchronous code over your HTML content. The setup of the tracker should be directly after the <body> tag whereas the rest should be placed at the very end of your document (as described above).

Hopefully, my description is clear enough to enjoy a smooth and seamless code integration between Google Analytics Asynchronous Tracking and AddThis Sharing.

 
Finally tweeting PDF
Community
Monday, 08 February 2010 07:46

Finally, I could convince myself to register an account on Twitter to start micro-blogging. The registration is free, easy and straight forward. No woes at all...

I could have set up a tweet already ages ago but honestly I have to say that I never had any real motivation about this whole concept. Even now, I am not 100% sure about the pros and benefits of Twitter are. Maybe I will get some feedback on this during the next weeks. Perhaps I might use this micro-blogging space for some more questions or even rants... Let's see. ;)

Anyways, the "Get in contact" area in the sidebar is updated and you might follow my tweet on this URL: http://www.twitter.com/JKirstaetter

Sadly, my alias "JoKi" is alerady in use by someone else, but that's life: First come, first serve.

One of the next things I am going to do is to check out of one the many Codeplex projects, namely VFPTweetAPI by Olaf Doschke. First of all, it is to get more familiar with Twitter itself and second I hope that it is easier to tweet from VFP directly than to launch my favorite browser. And last but not least, I might integrate the component into one of my projects like Sunshine.

Definetily more on this topic in the future...

 
InfoTech 2008 PDF
Community
Friday, 08 August 2008 11:43

The National Computer Board (NCB) invited to visit their annually InfoTech fair at the Swami Vivekananda International Convention Centre. This event marks the peak of IT sector here on the island and a lot of well-known companies showed their business stuff at the Exhibition Space.

Actually, I had several chances to meet people from Microsoft Indian Ocean, the University of Mauritius and the University of Technology, Mauritius

After all I spend some nice hours at the Convention Centre. Looking forward to Infotech 2009.

 

 
Another MVP in Mauritius PDF
Community
Friday, 14 March 2008 14:37
Cool!

Recently, I found out that there is another Microsoft Most Valuable Professional (MVP) in Mauritius. He is nominated in Windows Mobile and writes a lot of information on this topic in his blog about PocketPC. Really interesting and maybe useful for future purposes.

Have a look at his blog.


Sincerely, JoKi

 
Plans for Mauritius Software Developer User Group (MSDUG) PDF
Community
Tuesday, 04 March 2008 15:35
You know... Old habits don't fall off!

And so, I'm still interested in starting and operating (again) a local user group. This one is more in general about topics according to software development, design and data storage than my last ones back in Germany. Because I was maintainer of a regional user group of the German FoxPro User Group I'd like to use my experiences in this field to kick-off a new user group here in Mauritius. This idea is already since the very first beginning on my mind, but because of my work I didn't have the time yet to get more details and so on....

At the end of January, I already tried to set up such a new user group but because of cyclonic weather conditions we postponed the meeting. Now, I think it's really time for a second attempt to found the user group. Well, you might think: Not another one but actually first I did some research on existing user groups here in Mauritius and yes, there are some (.NET, Linux and probably for PHP) but the current situation is that they seem to be inactive or endagered. At last, I was not able to get recent information about meetings.

And based on this situation, I'm enthuastic about running 'my own' user group for software engineers, developers in general and database related topics. The main focus will be development on the Windows operating systems - to be precise we are going to talk about Visual Studio, SQL Server, Office System and Visual FoxPro - but the topics are not restricted. People that know me, know that even at the dFPUG meetings we also talked about things than VFP.

As you see in the subject of this article the name is already there:

Mauritius Software Developer User Group (MSDUG)

But for sure, I'd like to see way more than just a name, this article and an outdated homepage on the internet. The concepts are there but not fixed yet. Currently, I'm searching a nice location where we can meet regularly. The former user groups seem to have the DCDM in Quatre Bornes as there location. Well, this sounds good, lies central and is accessible from almost anywhere on the island by bus. But I don't like to share the same fate with the others. So, if any Mauritian is reading this article please drop me a mail or leave a comment. Thanks in advance.

Later on this year, I'd like to promote the MSDUG on local events like job market fairs, events at the University of Technology in Reduit and other opportunities. We will see what the future will bring.


This is it at the moment from the MSDUG. Sincerely, JoKi

PS: Any comment is welcome, please don't hesitate...

Sincerely, JoKi
 
« StartPrev12345678910NextEnd »

Page 1 of 20
Spacer for layout formatting
About me
Microsoft Most Valuable Professional 2007 & 2008

Microsoft Certified Professional

Get in contact

Follow Jochen Kirstaetter (JoKi) on Twitter JoKi @ ICQ JoKi @ Skype


Recent books

  • MCTS 70-536 - .NET Framework 2.0 Application Development Foundation
  • Code-Centric: T-SQL Programming with Stored Procedures and Triggers
  • Microsoft .NET Framework-Programmierung in C#

Community

deutschsprachige FoxPro User Group

Microsoft Community Leader/Insider Program

International .NET Association

O'Reilly Verlag
Sponsoring
If you like the information on these pages, your support is highly appreciated.
Thank you very much!