Showing posts with label blog. Show all posts
Showing posts with label blog. Show all posts

Sunday, December 6, 2009

Google Analytics new asynchronous tracking code

Google Analytics has now provides new asynchronous tracking code. The main feature of the asynchronous code is that it could load ga.js while the page is being rendered.

There are two ways to use this code.

  1. Place the code below before the  </head> tag.
     <script type="text/javascript">  
     var _gaq = _gaq || [];  
     _gaq.push(['_setAccount', 'UA-XXXXX-X']);  
     _gaq.push(['_trackPageview']);  
     (function() {  
       var ga = document.createElement('script');  
       ga.src = ('https:' == document.location.protocol  
         ? 'https://ssl' : 'http://www')  
         + '.google-analytics.com/ga.js';  
       ga.setAttribute('async', 'true');  
       document.documentElement.firstChild.appendChild(ga);  
     })();  
     </script>  
    

  2. Split the code. Half of the code will be put before the </head> tag. Another half will be put at the end of the page, before the </body> tag.
    The first half (before </head> the tag).
     <script type="text/javascript">  
     var _gaq = _gaq || [];  
     _gaq.push(['_setAccount', 'UA-XXXXX-X']);  
     _gaq.push(['_trackPageview']);  
     </script>  
    
    The second half (before </body> the tag).
     <script type="text/javascript">  
     (function() {  
       var ga = document.createElement('script');  
       ga.src = ('https:' == document.location.protocol  
         ? 'https://ssl' : 'http://www')  
         + '.google-analytics.com/ga.js';  
       ga.setAttribute('async', 'true');  
       document.documentElement.firstChild.appendChild(ga);  
     })();  
     </script>  
    

Note:

  1. Remove any existing Google Analytics code before using this asynchronous code.

  2. Disable any Google Analytics plugin (if you use one) for WordPress.

  3. Replace UA-XXXXX-X with your web property ID.

Thursday, November 19, 2009

How to use CSS to style code snippets

It is easy to use CSS to style code snippets, as shown in Figure 1.

[caption id="attachment_2836" align="alignnone" caption="Figure 1: Sample output of CSS style for code snippets"]Figure 1: Sample output of CSS style for code snippets[/caption]


Step 1: Append this code inside a style sheet.


pre{ font-size:12px; background:#fff; border:1px solid #000; line-height:20px; width:600px; overflow:auto; overflow-y:hidden; margin:0; padding:0; } pre code{ font-family:Monaco,Courier; display:block; margin:0 0 0 40px; padding:18px 0; } 

Step 2: Put the code snippets inside <pre> and <code> tags.


<pre><code>def f(): txt = "Some sample code" return txt </code></pre>

Friday, June 19, 2009

Free desktop client for Google Analytics

Polaris is a free desktop client for Google Analytics for single website.

To monitor multiple websites, Polaris costs $15 per year.

Here are some snapshots of Polaris.

The Dashboard.


Shows which keywords are used mostly on searches.

Referring Sites.

Top Content.

Traffic Sources.

Map Overlay.


Visits Overview.

How to get Polaris


Click here to download Polaris.

Click here to download Adobe Air (required).

Sunday, May 25, 2008

Two Web Analytics Software for Desktop

Most of use might have used Google Analytics for whatever reasons. Google Analytics could help us to learn about where our visitors come from and how they interact with our site. This service is brought online by Google for free.



Ever wonder if you could view your Google Analytics results at your desktop? Yes, it can be done by using a software developed by Nicolas, called Google Analytics AIR. It was built under the Adobe AIR platform. However, you still need to have the Google Analytics account in order to use this software.

The second desktop Web analytics software is by Woopra. The platform used is Java, and is developed by Woopra. Although Woopra is currently in it's beta stage, don't under estimated it. It can even gives you live report, i.e. how many users are currently visiting your site. In order to use this software, you need to have an account with Woopra.



In my humble opinion, Woopra is better than Google Analytics, especially the reporting style. What about you?

Wednesday, April 16, 2008

How to embed source code in a blog

code

To embed source code inside blogger blog, like in the picture above, I use a css box like below:

.code {
font-family: ‘Courier New’, Courier, monospace;
white-space: pre;
line-height: 1.4em;
margin: 1em 0;
border: 1px dashed #aaa8a8;
padding: 0.5em 0 0.3em 0.5em;
font-size: 100%;
color: #000;
overflow: auto;
max-width: 100%;
/*max-height: 400px;*/
}


To use it just call the class named ’code’ using div.
<div class="code"> The source code goes here! </div>

The tab will be preserved. In order to limit the height of the box, remove the comment (”/*” and “*/”) from the last line, and set the desired height.
/* max-height: 400px; */

For some reason, in IE, the text will be wrapped instead of displaying the scroll bar. However, it works just fine inside Firefox and Opera. If you have suggestion on how to solve this problem, don’t hesitate to leave a comment.

Check your blog load time

This tool could be used to determine a blog load time.

Enter your domain name in the text box, for example rizauddin.com: