Browsing articles in "Web Development"
Aug 19, 2010

Read Google Analytics Cookie Script

I’ve taken some time out to write a script that provides a nice API to access Google cookies. If you’ve seen the Google cookies before, they can look pretty cryptic and will require you to memorise the syntax of how the cookies are formed which you don’t necessarily want to do to save brain space.

 I won’t really go into the intricate details of Google cookies so this post will assume you know what you’re looking for. I may write up a post to explain more in-depth how Google cookies work later on. In the mean time, you can watch this presentation by Google on cookies (it’s pretty good!) or read the documentation to find out more about Google cookies.

So how is this useful? Well it really depends. You may use it to read GA campaign values and integrate it with your CRM system to track where your leads/sales are coming from or write custom scripts that integrate with GA (i.e. custom variables). It’s really up to you!

Anyway, on to the script.
Continue reading »

Oct 5, 2009

SEO Implications of using CSS Display None/Image Replacement

It is a known problem that search engine crawlers aren’t able to read images, hence they aren’t able to determine what the image is about. However, this can be overcomed by utilising the alt attribute of the img tag to describe the image so that search engines are able to read what the image is about.

On the other hand, I do believe that it may be better to optimise your on-page using actual text than using the image alt attribute on certain situations. How you can do this is by using CSS to replace text that can either be within anchor, header tags or simply text in general with background images . Obviously you don’t want to overdo this (i.e. apply to all images on the page) lest you trigger Google‘s spam alert and also it’s very time consuming!

So is using CSS to optimise your on-page illegal in the eyes of Google? Will you be considered trying to obfuscate the search engines for SEO purposes, hence getting yourself banned from the SERPs? The answer to this is how you do it and the question to ask yourself is, are you trying to be dodgy?

The Way To Get Yourself Banned

In Google Webmasters help under hidden text and links, it is pretty clear what are the criterias to get yourself banned. Although not in the list, I would avoid using text-indent: -9999px to hide your text but rather use display:none instead.

I would say the reason for this is because the text-indent property according to w3c is to be used for text formatting purposes, not visual formatting. However, the display property is used for visual formatting purposes instead which fits the purpose of using it to ‘replace’ text with images as it is a visual aspect.

Algorithmically, Google does not ban websites from the SERPs that use CSS to hide things and obviously would go through some sort of manual review. That’s why it’s important that you ensure you don’t have comments in the source code that reveal your intention of keyword spamming or displaying optimised keywords only for the search engines.

The simply rule to follow is this: if you find yourself questioning whether what you’re doing is spam worthy, then it’s probably spam worthy. What you want to make sure is that you’re using css image replacements with the right intention which is to provide accessibility to users that have CSS disabled and to ensure that search engines are able to read and recognise the important aspects of your page that add value to the user experience.

Using CSS Image Replacement The Right Way

allianz-css

Let’s take a look at Allianz’s homepage, a major insurance provider and how they’ve used CSS replacement the correct way.

You can see on the homepage that navigation menu (highlighted in red box) comprises of image menu items that search engines aren’t able to read. Well, they can actually read it if the image files are optimised with the alt attribute, however I do believe that optimised anchor texts have a greater weighting in SEO than image alt attributes. This use of images is obviously aesthetically more appealing to the user than using normal anchor text.

Looking at the non-CSS version when you disable CSS, you can see below (highlighted in red box) that these navigational menus are actually anchor texts. From a text perspective, this is essentially what search engines see when they’re crawling the site.

Continue reading »

Sep 30, 2009

Geo Targeting / Localisation on Google Bing Yahoo

When launching a website, it is important to identify where your target audience is located and to ensure that you get found within that region. For example, if you were an e-commerce store in Australia where you only shipped goods locally and not internationally, your target customers would be Australians and hence why it is important for you to localise your website to the local search engines.

The reason for this is whenever a user types in Google.com or Yahoo.com into their browser, these search engines will redirect them to the localised search engines based on IP detection. This means that if you’re browsing from Australia and you type in Google.com, you will be redirected to Google.com.au and for Yahoo.com, au.Yahoo.com. Once you’re at these localised search engines, you have the option of choosing local search results only.

Google AU

Yahoo AU

Bing AU

This means that if you are found on these localised search results, the organic traffic that you will be getting highly qualified. This is a win-win for both search engines and website owners as search engines are serving more relevant search results, thus better quality and website owners are receiving relevant localised traffic. It’s all about relevancy!

Now you know the importance of localisation (or geo-targeting), here’s some common factors that search engines look for and factors specific to the major search engines (Google, Bing, Yahoo).

Continue reading »

May 26, 2009

Goal & Funnel Setup Guide in Google Analytics

Working in a Google Analytics Authorised Consultants (GAAC) accredited company and also having a Google Analytics Individual Qualification (GAIQ), it is essential that I master the art of setting up goals and funnels in Google Analytics for our clients.

A goal can be a very important metric for a client to track such as sales, newsletter sign-ups, and registrations. Of course goals are not just limited to those but can be extended to whatever you would define as an important action on the website to track. Not only is tracking important, but it is also vital that you gain insight into what’s going on in the goal process from funnels.

goal-graph

A funnel is a visual representation of what’s happening during each step of your goal. It gives you great insights into the drop off rates of each step so that you can make informed decisions on improving your goal process and landing pages to increase conversion rates. You can accurately pinpoint which step of the goal process are you getting high drop off rates.

This can help you identify problems such as the checkout button not working, too many call to actions that lead to other goals, not best practice usability and so on.
Continue reading »

Apr 5, 2009

How To Track Sub-Domains / Cross-Domains in Google Analytics

First of all, let me explain why in Google Analytics you need to do some configurations to track sub-domains / cross-domains.

Google Analytics does not do this by default, thus whenever you’re on sub1.domain.com and you go to sub2.domain.com, Google Analytics will record this as a referral rather than maintaining the same session and the same campaign information. If you’re running e-commerce tracking and you use sub-domains during the e-commerce process, this will totally screw up your reports as it will attribute all transactions to referrals (from your own site) and you will have no idea how your other online marketing campaigns (i.e. direct, organic, cpc) are performing.

Sub-Domain Tracking

This one is fairly easy. The method you need to use is _setDomainName().

Google utma cookie

The _setDomainName() method sets the Google cookies to the domain name string parameter that it is given, otherwise it automatically resolves the domain name from the location object in the DOM if no parameter is given. This means that on sub-domains, the cookies will be set to separate sub-domains.

So to configure Google Analytics to set the cookies to the same domain name, simply use the domain name as the string parameter for the _setDomainName() method.

E.g. If I have a website called sub1.dannytalk.com and sub2.dannytalk.com, I would use _setDomainName(‘dannytalk.com’) throughout all my pages (sub-domains and main domain).

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-x"); // replace this with your own account number
pageTracker._setDomainName("dannytalk.com");
pageTracker._trackPageview();
</script>

The Google API officially states to use the period at the start of the domain name. I have tried with and without and it seems to work fine but I prefer without period (looks nicer).

Once you’ve done this, Google Analytics should record all visits to these sub-domains as the same visit, maintaining the same campaign information. However, in your reports,you won’t be able to tell which request URI came from which sub-domain as the domain name is stripped out from the reports.

In addition, if you have two sub-domains that have the same page name (i.e. index.html), then Google Analytics will combine these two into one which will artificially inflate your page statistics.

A simple way around this is to implement what I call a sub-domain visibility filter which will prefix your request URI’s with the domain name. This will help you differentiate the pages as well as avoid inflating the page statistics.

Continue reading »

Pages:123456»

Twitter Updates