GA tracking code

Good Morning,

I have a question about the google Tracking code w the FW action.

by using the action, it automatically adds the tracking code in our site.

I know on the GA site there is a code you put in - but with our action it makes that step un necessary.

but if I had to add to it (for tracking outgoing links) how do I do that?

Thank you.

Yes Walter, I am going to attempt this.

here is the us link (which is no different than the one Dave supplied.)

Also, how would I add the Javascript Code that is mentioned here.

Thank You again!

Julie


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It appears that you need to add an extra line of code to what the action provides so you will have to do this manually using Page>HTML markup. But remove the action first because the following includes what the action would place.

Paste code in before end Head

<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';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    var pageTracker = _gat._getTracker('UA-XXXXX-X'); pageTracker._trackPageview();
  })();

</script>

And then add the extra JS stuff

<script type="text/javascript">
function recordOutboundLink(link, category, action) {
  try {
    var pageTracker=_gat._getTracker("UA-XXXXX-X");
    pageTracker._trackEvent(category, action);
    setTimeout('document.location = "' + link.href + '"', 100)
  }catch(err){}
}
</script>

So the finished markup should look like this

<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';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    var pageTracker = _gat._getTracker('UA-XXXXX-X'); pageTracker._trackPageview();
  })();

</script>
<script type="text/javascript">
function recordOutboundLink(link, category, action) {
  try {
    var pageTracker=_gat._getTracker("UA-XXXXX-X");
    pageTracker._trackEvent(category, action);
    setTimeout('document.location = "' + link.href + '"', 100)
  }catch(err){}
}
</script>

Once you have done this you then need to add some code to the outbound links using the extended part of the Link dialogue box.

So with your link in the External box click on Extended and create a new name/value pair of

Name: onClick
Value: recordOutboundLink(this, 'Outbound Links', 'example.com');return false;

And do this for every link that you want to track.

Now I haven’t actually done this but it is worth trying on a test page.

Or try Clicky as H suggested - it may be easier!

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thank you Dave,

THe clicky sounds easy. But I want to try this out on a page to see how it goes.

J
On Oct 8, 2010, at 3:32 PM, DeltaDave wrote:

It appears that you need to add an extra line of code to what the action provides so you will have to do this manually using Page>HTML markup. But remove the action first because the following includes what the action would place.

Paste code in before end Head

<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';
   var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
   var pageTracker = _gat._getTracker('UA-XXXXX-X'); pageTracker._trackPageview();
 })();

</script>

And then add the extra JS stuff

<script type="text/javascript">
function recordOutboundLink(link, category, action) {
 try {
   var pageTracker=_gat._getTracker("UA-XXXXX-X");
   pageTracker._trackEvent(category, action);
   setTimeout('document.location = "' + link.href + '"', 100)
 }catch(err){}
}
</script>

So the finished markup should look like this

<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';
   var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
   var pageTracker = _gat._getTracker('UA-XXXXX-X'); pageTracker._trackPageview();
 })();

</script>
<script type="text/javascript">
function recordOutboundLink(link, category, action) {
 try {
   var pageTracker=_gat._getTracker("UA-XXXXX-X");
   pageTracker._trackEvent(category, action);
   setTimeout('document.location = "' + link.href + '"', 100)
 }catch(err){}
}
</script>

Once you have done this you then need to add some code to the outbound links using the extended part of the Link dialogue box.

So with your link in the External box click on Extended and create a new name/value pair of

Name: onClick
Value: recordOutboundLink(this, 'Outbound Links', 'example.com');return false;

And do this for every link that you want to track.

Now I haven’t actually done this but it is worth trying on a test page.

Or try Clicky as H suggested - it may be easier!

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options