Book errata – corrections and typos, 1st edition

Many thanks to those who have provided feedback on the book so far. A couple of typos have slipped by me, so I wanted to post them here immediately. Please add if you find more. I will create a separate corrections page if needed.

Note: this post is for the first edition of the book. The second edition (2010) errata post is part of the Pro Lounge.

  • page 180, Differentiating Regional Search Engines:

The placement of this code has had to change due to recent updates in the GATC. See the following post:

  • page 181/182:

The code pageTracker._addOrganic(“”, “prev”); should be placed just before the line pageTracker._initData(); – Not after, as mentioned on page 178 (grey box, positioning of GATC hacks).

pageTracker._addOrganic("", "prev"); pageTracker._initData();
  • page 191, point a (referring to Figure 9.8a):

The regular expression pattern should be: (?|&)(q|p)=([^&]*) as shown in Figure 9.8a. Note the change in position of *

Thanks to Bart Geerling, of Google Amsterdam for these two.

Looking for a keynote speaker, or wish to hire Brian…?

If you are an organisation wishing to hire me and my team, please view the Contact page. I am based in Sweden and advise organisations in Europe as well as North America.

You May Also Like…

Sayonara Universal Analytics

Sayonara Universal Analytics

My first Google Analytics data point was 15th May 2005 for UA-20024. If you are of a certain age, that may sound off...


  1. Alex Kine

    Re: Multiple Domain Tracking

    Hi Brian,

    On Wednesday, we begin our second class using Advanced Web Metrics with Google Analytics, 2nd Ed at Bellevue College Continuing Education: It is both an excellent textbook and a great desktop reference for students in their jobs.

    Regarding Multiple Domain Tracking (Pp. 200-205), an apparent discrepancy appears between the book and the examples Google provides at Specifically, Google includes _setAllowHash(false); in some instances where the book omits it:
    * Tracking Across a Domain and a Sub-directory of Another Domain (Primary and Secondary)
    * Tracking Across Multiple Domains and Sub-domains (Secondary)

    Are these differences significant or matters of style?

    Thank you and I look forward to the next edition.

    Take care,


    • Brian Clifton

      Alex: Thanks for the feedback. The difference is odd and new from G. Essentially _setDomainName(‘none’); turns off the hashing (set it equal to 1), so I am not sure why this is now showing in the G documentation. Let me take a look and some back to you.

      • Brian Clifton

        OK, I have verified that the codesite needs updating. I mentioned in my last reply, setAllowHash(false) is not needed if you use setDomainName(‘none’).

  2. Andy Hoover

    Hi Brian,

    On pages 409 (bottom) – 410 (top), under “Special Case: Pseudo…”, should the e-commerce field values be in single (‘) quotes?

    Your book is a competitive advantage.

    Thank you,

    • Brian Clifton

      Andy: Well spotted. Yes you are correct as the e-commerce calls are nested quotes, so should be single quotes. Thanks for the heads up. I will add this to the erata page (yours is the first entry!)

  3. Franck Durandot

    Thanks a lot for your answers Brian and Rick.
    I will happy to see your feedback about your real sites Brian when you have some time.
    (Maybe it’s just a copy/paste problem with the code sample on this site ?)

  4. Rick

    paolo –

    were you ever able to figure out the issues with ext tracking? i troubleshot that over the past couple weeks and have been able to get mine working with couple of tweaks. let me know if need help

    • Brian Clifton

      Rick and Franck: Thanks for the feedback. I am running the first and last referrer hack and had no problems when last checked (admittedly end of 2009). Let me recheck that account and report back here – allow about a week…

      Rick – you make a good point. I am not a commercial programmer and hence I provide the script “as is” to demonstrate the flexibility of the GA model and what can be achieved. If it’s a valuable hack for your business, my recommendation would be for you to employ a professional to build on top the hack and support it for your specific needs – everyone has their own specific needs! As you are no doubt aware, I am happy for people to reuse, build and enhance and code itself, I just ask you to reference me as the originator.

      That said, I am always looking for ways to improve the process myself. If you feel there is value in my company providing support the hacks direct please contact me: brian@this_domain dot com. I am thinking that a paid for subscription service could work…

  5. Rick

    Franck & all –

    Brian Clifton is without a doubt one of the most renowned analytics gurus and has done unbelievable things. I walk in large footsteps.

    With respect to the first and last referrer script, a few words of caution. If you’re not an expert with JS I advise against using it. If you are looking for a solution for client or for any situation where updating the script is not easily done, don’t use it.

    When Google deprecated some of the language being used in the script it wreaked havoc on a site of mine with 200 subdomains – each owned separately. Visits inflated by the sum of 50,000 per day, all reported in GA with less than 1 pageview per visit and zero seconds time on site. Since 200 site owners are involved in the GATC swap, you can imagine the catastrophe on a collective domain getting 10 million visits a month. I only bring up the loss of the client and an 80% loss of our income to illustrate why caution is advised.

    There could be a very simple solution, but i had no one to go but Mr. Clifton, since I’m not all that handy with JS.

    Basically, Google doesn’t want you doing this. They will be continuing to change the language used in the api, and will not support it. There have been several updates to the code and we see tweaks/corrections put in frequently. It’s a great script – I’m not arguing against it. Just be aware that if you put this in place it will require maintenance, and during updates it may skew your data to the point of uselessness.

    I emailed Brian about my situation some time ago asking for advice and never heard back from him, so it really isn’t “supported” by him either. This isn’t a jab at the reputable Clifton, just trying to make everyone reading and participating in the discussion aware of the implications involved in using the script. And DONT forget to include the advanced filter that isn’t on the script page. Without that your data will be masticated and spit out.

    Final point – if you are looking for an awesome solution to track key metrics Google doesn’t allow you to and have easy access to making change on your site – go for it. It’s extremely helpful information.

    If you are an agency or manage multiple domains or don’t have easy access to making changes, run away unless you want clients to leave you after their data has been butchered.

    My request still stands for even an hour phone call with Brian Clifton if you’re interested – I’m happy to pay you for your time. While these discussions are very helpful, I still don’t see a version that supported by confidence, nor the reasons things are going wrong or the reasons the fixes worked. My priority is to understand what went so horribly wrong and understand why, identify a fix, and understand why the changes in the fix did work.

  6. Franck Durandot

    Me gain !
    I find something interesting : all the 21 visitors recorded used Safari or Chrome !
    So maybe it’s something in the javascript that can’t be well interpreted by the other browsers… or somthing like that.
    Do you have used succesfully this script on some real sites ?

  7. Franck Durandot

    I check the day after and I think there’s still a problem.
    It seems that it record a very few part of the visitors.
    Usualy I got around 500 visitors in analytics at noon, and today I only got 21 !
    On this 21, there’s 1 visitor with first referrer caught.
    So it seems to work… just a little bit !
    Sorry, I can’t continue the experience more, because I loose data for my customer 🙁

  8. Franck Durandot


    I think there’s an error in # Chapter 9: page 205: Capturing the first-and-last-referrer.txt

    I try this script and no more data at all were grabbed in my GA 🙁

    I think it’s on the line:
    document.write(unescape(“%3Cscript src='” + gaJsHost + “’ type=’text/javascript”%3E%3C/script%3E”));

    After text/javascript, it should be a ‘ and not a “.

    I just modify it, I will see in a few hours if it works better like this.

    I hope it will work because I find this script powerful !


  9. Niklas Hjelm

    Hi Brian
    I’ve really enjoyed reading your book and I only have one question that I hope you can find the time to answer. I’m using your subdomain tracking filter on page 139: pageTracker._setDomainName(“”) so that first party cookies can be shared across subdomains. This works fine but how would you set up tracking over multible domains AND subdomains? On page 141 you set the domain name to “none” for multible domain tracking. Let’s say for instance you want to track to, how would you set this up?

    Best regards

    / Niklas

    • Brian Clifton

      Niklas: Thanks for the generous feedback. For this scenario – tracking a visitor across subdomains and third-party domains, you need to use the setAllowHash(false); function. On your main site (with the subdomains) add the following just above your _trackPagview call e.g.

      try {
      var pageTracker = _gat._getTracker(“UA-12345-1”);
      } catch(err) {}

      I detail this in the second edition of the book… stay tuned!

  10. Rick

    I wasn’t sure where to post this, so my apologies if this is not the correct place. I had a question regarding the first and last referrer script. It appears to be working, but in my analytics it is showing up with “first” shown twice. As an example:

    (direct), first=-|(none)|(direct) / (none), first=-|(none)|(direct)

    This is the case for Keywords, Sources and Medium.

    Any insight you could provide would be extremely helpful and much appreciated.

    Thanks Brian!

  11. paolo

    hi, I am using the Combined tracking script and added onLoad=”addLinkerEvents() in the body tag as well as:

    part to my site. However I don´t see any results for outgoing traffic from our site. I have made some visits and clicked on our outgoing links but is not displayed in the Google Analytics portal.
    Any suggestions anyone?

  12. Helge

    Problem with filter for “Pay-Per-Click Search Terms and Bid Terms” (page 192):

    Considering the keyword list at Traffic Sources-AdWords-Adwords Campaigns, Dimension:Keyword
    there are just a few entries in the form “bidterm,(search term)”.
    Many entries consist of just one term (and without “,()”).

    It seems as if the second filter “Override bidterm 2” often does nothing.
    Thats maybe because “Field A Required” is set to “Yes” and that field is empty.
    (Or what does this requirement mean?)
    Field A should contain the output of the first filter “Override bid term”.
    That output should be a part of the referral.
    Maybe the referral is often empty.
    (The filter that outputs the referral (Field A: Referral (.*) Output to: User Defined $A1) seems to prove that it is often empty.)

    Has anyone the same sorrows?
    Or better: Can anyone eliminate some of my “maybe”‘s?
    Or even better: Has anyone a solution?

  13. Jen

    Dear Mr. Clifton,

    I have just received your book in the post through Anazon and have been poring over it -it’s exactly what I have been looking for for about a year. I had originally looked at ordering it along with the “Web Analytics for Dummies”, and the Avinash “…hour a day” book, but had gotten the impression it was too techy or high-brow – not being a programmer myself but a marketer.
    Not so at all! You are clearly a good and patient teacher and this comes through in your writing style, for which my thanks.

    So may I suggest for the second version two things: in terms of positioning, although the cover is very nice it does smack a little of an advanced Maths book and therefore a little daunting.
    Yet as a self-employed marketer that solely gets paid on results it is exactly what I – and every other marketer – needs to ensure our marketing ideas are measured accurately.

    My second request has to do with all that code. You see, I don’t speak Java. But I have no problem copying and pasting it from a text file. Trying to duplicate the .js code from a page onto the screen is impossible. Trying to see if the [‘s or the |’s need to be typed in one line along with the \&’s, … I’m sure you get my meaning.

    As a consumer (bookbuyer) I could really use either a CD that goes along with the book, but that’s pricey. Or, instead of the Free Adwords voucher (your bookbuyers might prefer a voucher they can use on an existing account, not to set one up) you could supply a log in code to access the files. It’s risky I know, people could pass the login details around….but still you’d collect at least one email address.

    All in all, I am overjoyed that someone has taken the time to write so clearly, lucidly and succinctly what we can’t seem to find in the Google Analytics Help centre.

    Thanks again.


  14. Alex S

    Have only just started going through this book (very interesting, thanks).

    I’m sure I am nitpicking but on your table of economic effects (page 8 – table 1.2) you mention that ‘non-marketing costs’ is ‘non-marketing profit margin’ times ‘total revenue’ but the actual calculation (as you did on your download) is the inverse of that. (1 – ‘non-marketing profit margin’) times ‘total revenue’.

    • Brian Clifton

      Alex: Thanks – the download is correct and will be reflected in the second edition of the book.

  15. Brian Clifton

    Mikhail: well spotted – I have started introducing typos into my typo corrections! the first / is in the book version and I have added to the original post.

    Jennifer: Not sure who you are referring to (Scott!), but the removal of initData() call will have no effect. I am running this script on several sites without problems, so I would check your implementation – particularly ensuring javascript lines stay intact i.e. do not line wrap and standard quotes have not been converted into smart quotes. Also checkout:

  16. Jennifer Davis

    Scott, really interested in the first/last referrer script starting on page 205. I grabbed the updated version from the site, but still can’t get it to work. It is not setting the variable. It looks as though the first check to see if it is a new visitor is not functioning, wondering if it is because pageTracker._initData(); is no longer necessary.

    If I take out the if statement on the new visitor I can get the variable to set, but of course it simply resets upon the next visit since the new visitor function is no longer being called.

  17. Mikhail

    To: * page 191, point a (referring to Figure 9.8a):
    The regular expression pattern should be: (?|&)(q|p)=([^&]*) as shown in Figure 9.8a. Note the change in position of *

    (?|&)(q|p)=([^&]*) is invalid regular expression :)!

    Regular expression pattern should be: (\?|&)(q|p)=([^&]*)

  18. Brian Clifton

    Bill: Yes you are correct. When I wrote the Event Tracker section (Dec 07), it was still in beta and the exact syntax has changed.

    Its not too dramatic though – just ignore the object creation in the GATC of page 132 and insert the Category name in the call to the _trackEvent function.

    Essentially this is the same thing, as the object declaration is now handled within the _trackEvent function itself. Basically, now it is even easier to implement.

    More details can be found at:

    BTW, if you use the syntax described in the book, event tracking still works in the same way.

  19. Bill T

    Enjoying your book. Page 136(event tracking) includes a deprecated function”_createEventTracker”, I’d be happy to read how to do this. Note: This affects bounce rate(due to page load event.

  20. Brian Clifton

    Emiel – yes, spot on and many thanks to both of you for the heads up. There should be a continuation arrow in the book (as per the code at the top of page 185). This is now oon my list

    Anthony – yes, in fact I just discussed with the publisher last week. However, the time line is likely to be mid-2009. Essentially the new features (including Advanced Segments, API, Custom Reporting, Motion Charts) need to be fully released so I can build some real world examples. If you have any Advanced Segments who would like to share, please contact me directly.

  21. Emiel

    Alex – it shoud be written in one continuous line:
    document.cookie = “__utmv=”+_udh+”.”+_uES(labelVal)+”;path=”+_utcp+”; expires=”+date.toGMTString()+”;”+udo;

  22. Anthony

    Brian – are there any plans to update the book with the newly released Advanced Segments and Custom Reports?

  23. Brian Clifton

    Andy: The _initData(); call is now deprecated in the GATC so you don’t need to include this any more

  24. Andy Harris

    On page 121 (Using a Third-Party Payment Gateway) it shows two lines in the code as bold as follows …


    I’m in the process of installing GA for just that purpose, took the basic GA code but noticed that it didn’t have the following line in it as shown in the book:


    Does this mean that the line in the book should also be bold as it’s supposed to be added into the GA code as well as the other two lines in bold within the book?

    Fantastic book – a real eye opener. Also thick enough to beat clients over the head when they STILL don’t get it that they need to strengthen their websites even after seeing statistical evidence!

  25. Alex Fiennes


    I’m trying to use your code on page 185 for Sessionizing Visitor Labels, but I’m just getting a load of javascript errors about not being able to find _udh or _uES and other variables.

    Is there something that I should be doing to define these variables that isn’t clear in the book or has ga.js moved the goalpost and isn’t defining them any more?

    Thank you


  26. Brian Clifton

    Ziv: Many thanks for the feedback.

    At the time of writing the Event Tracking feature was in closed beta. It was expected that this would be available some time in Q2 but unfortunately it still hasn’t made it. Essentially I jumped the gun!

    The feature will be released, however I am unable to say when. Fingers crossed its this year…

  27. Ziv

    Dear Brian,

    As most of the people have mentioned above, THANK YOU for this very useful book on GA. We were very excited with the sub-chapter on event tracking (noted in the book to be in BETA). When trying to implement the recommended technique in the book, we can’t seem to find some of what you speak of in GA. Have they discontinued event tracking? Are we missing something obvious? We did click to edit our profile and “enable” event tracking but this isn’t an option anywhere. We are using the new GA.

    Thanks in advance if you have some insight!


  28. Brian Clifton

    Yes, yours will work just as good.

    Allaedin: Thanks for the feedback. Well spotted for page 131. You are correct – the joys of cut&paste…

  29. Allaedin Ezzedin

    Hi Brian,

    Thanks for the wonderful book – a terrific job!

    In page 131

    pageTracker._setCampNameKey(“orig_campaign”); // default: utm_medium

    I think you meant (default: utm_campaign)

    pageTracker._setCampNameKey(“orig_campaign”); // default: utm_campaign

    Thank you,

  30. Mad.Photo.World

    I was wondering why the regexp is written with 3 groups?

    You are only referencing one, the third ($A3). So to be more clear it should be written as [\?|&][q|p]=([^&]*) and the the $A3, should be changed to $A1 or am i missing something ?

  31. Brian Clifton

    Scatterplot: The space doesn’t have a name as this represents visitors who left the site. I agree its not clear with the word “abandoned” overlapping the boundary.

    Abandoned in this chart represents those visitors that entered the conversion funnel but did not complete.

    HTH. Brian

  32. Scatterplot

    Hi there,
    I am wondering about a detail of a graph in your book “advanced webmetrics”. On page 5 there is shown how to divide visitors in “bounced” and “nonbounced”. The “nonbounced” are divided into “conversions” and “abandoned” and there is some space left free. (the letters “oned” from abandoned are in that area) Is this accidently or has this space a name?

    Thank you for help

  33. Brian Clifton

    Thanks Rita

    Lary: I have been testing the script and saw the same error as you. I couldn’t understand why this was, so I simply modified the ‘structure’ to remove the error and it now works.

    Essentially I just grouped the js code into 3 script tags. The file is listed in:

    Let me know if you get it working.

  34. Lary Stucker

    The first referrer code on page 205 is still not working. What is the deal here? Can you give us a working example somewher?

  35. Rita Williams

    p. 51 figure 4.2 f) and g) in the diagram do not match f) and g) in the descriptions or discussion on p. 53.

    p. 78 paragraph 2, line 6 “visitors not viewing the blog area spend spend slightly less time on the site(-20.45%” refers to figure 5.14 next page. This should be “less time on the page”.

    Thanks for a great book.


  36. Lary Stucker

    line 34- var pageTracker = _gat._getTracker(“UA-XXXXXX-X”)
    is giving me an error “_gat is not defined” am I doing something wrong or is this an error in the code?

    Yes I replaced the UA-XXXXXX-X with my GA account number.


  37. Brian Clifton

    Thanks Larry. You are of course correct.

  38. Lary Stucker

    Page 205: 6th line of your Modified GATC code has a closed script tag. It should be removed since the script doesn’t end there!


Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share This