[i109 Tutorial] Google Analytics for FBML

imperial109

Regular Member
Joined
Jan 19, 2009
Messages
499
Reaction score
365
Google Analytics is a powerful tracking tool that can give you
detailed reports about your traffic. It's a great tool to have
and it's free from the Google website. You will be able to see
how many people saw your page; how long people stayed
on your page; what region they are from; and many more.

What you really need to know about the coding is that
Code:
<fb:google-analytics uacct="UA-1234567-89" />
is your basic
tracker. As you may have guessed, uacct is your Analytics
account ID. This is required and you cannot do anything
useful without it. However, there are plenty of optional
attributes that can be used for advanced tracking.

Due to their numbers, I'll just give a basic rundown of each
one.

ufsc
A boolean, or true/false, function that either keeps the info
flag on or off, with 1 being on, and 0 being off. The default
setting for this is set to on.

udn
This is a string that specifies the domain for the cookie that
each visitor is given. The default is equal to auto, which is
apps.facebook.com. There are two more options that allow
you to not have the domain set, or to specify a name. For no
domain, set it to none, and for your domain, just type in your
desired domain, such as http://something.com.

uhash
If you do not want your unique domain hash to be on for
cookies, then set it to off. Otherwise, there is no need to
include it, since the default is set to on.

utimeout
Whenever a user is not active on your page, then you can
make the session to timeout after a specified number of
seconds. By default, the session ends after 1800 seconds.

ugifpath
If the _utm.gif file is located somewhere other than /_utm.gif,
then you need to set this value. Otherwise, just leave it out.

utsp
This is the transaction field separator, such as the pipe
character |. There are no limitations on this attribute, so all
other separators will also work.

uflash
When you want to turn off Flash version detection, then set
this equal to 0, otherwise set it to 1, or just leave it out
altogether.

utitle
This simple boolean function just detects the title. It is set
automatically to do so, but if you want it off, then set it to 0.

ulink
Unlike the other attributes, this one is off by default. It states
whether the linker function can be used, or not. Set it to 1, if
you want it on.

uanchor
If you want to have the anchors in a campaign to be
enabled, then set this one to 1. And as always, 0 is to
disable it.

utcp
It is a good idea to leave this on the default setting. If you
need to include the exact path for cookie tracking, then you
are allowed to set it. The default is the forward slash /.

usample
This setting is used to track a sample of visitors. It is counted
as a percent, so your options are to set it equal to any
number between 1 and 100. This is a percentage, but do not
include the symbol %. By default, all of your visitors are
tracked.

uctm
The campaign's tracking module can be turned on or off. Set
it to 0 if you want it off, otherwise, just leave it out. Set it to 1
if you really want it there, but it makes no difference as to
what it will do.

ucto
The timeout for the campaign tracking can be set in
seconds. By default, it is set to 15768000, which is also the
equivalent of six months.

uccn
When you have more than one website, you may have split
up your campaign. Set this equal to the name of your
campaign. Otherwise, exclude it.

ucmd
This specifies your campaign type. Your options are cpc,
cpm, link, email, and organic. If you want to track all of them,
then leave it at utm_medium.

ucsr
A string attribute that represents your campaign's source can
be set. If you leave it out, it will automatically be set to
utm_source.

uctr
This is also a string that represents your campaign's
keyword(s). The default is utm_term.
12

ucct
Another string which is similar to ucsr and uctr, is the
campaign's content.

ucid
Your campaign's unique ID can also be included, but it is not
necessary. This is an integer, so remember that it has to be
a number.

ucno
Set this string if you want to override the current campaign.
Otherwise, leave it out, or at utm_nooverride.
If you do not like facebook's coding for this tool, and if you
know JavaScript, you can include the FBJS(Facebook
JavaScript) code.
Code:
<fb:google-analytics>
<script src="https://ssl.google-analytics.com/urchin.js"
type="text/javascript"></script>
<script type="text/javascript">
_uacct = "UA-9999999-99";
urchinTracker();
</script>
</fb:google-analytics>
The Analytics function, urchinTracker, is enabled by setting it
to the outgoing website.
Code:
<a href="http://something.com"
onClick="facebook.urchinTracker('/outgoing/something.com')
" />
 
Back
Top