SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    732
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    google analytics. Where?

    Would you folks advise to place it in the header or footer.
    my experience i put in the footer. Does it matter?
    thx
    D

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,606
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Since the javascript file for google analytics is hosted on a different domain other than your own, the download will be asynchronous, thus won't much affect page load times. It's safe to put in the head.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,657
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    In the head to register all visits.

  4. #4
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    732
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Force, Picnic, thank you both. will do

  5. #5
    SitePoint Member
    Join Date
    Jun 2013
    Location
    Calgary, AB, Canada
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have successfully used this plugin on all my WP sites:

    http://wordpress.org/plugins/googleanalytics/

    Just enter your GA ID and save. GA will start tracking within a minute or so.

  6. #6
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    732
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    why bother w/a plugin when google does it?

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,189
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    One could also say "Why bother with Google Analytics when WordPress Stats does it?"

  8. #8
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    732
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    well where? I have not seen a metrics/visitor analysis/tracking that is native to wp. Or at least not in the wp admin panel.
    D

  9. #9
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,189
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    OK, you caught me

    There used to be the WordPress.com Stats plugin.
    WordPress.com stats has merged into Jetpack. Please use Jetpack instead of this plugin.
    ......
    WordPress.com stats has merged into Jetpack and all future upgrades to WordPress.com Stats will only be available in Jetpack. Jetpack connects your blog to the WordPress.com cloud, enabling awesome features. Get Jetpack now!
    http://jetpack.me/support/wordpress-com-stats/
    There are many plugins and services that provide statistics, but data can be overwhelming. WordPress.com Stats makes the most popular metrics easy to understand through a clear and attractive interface.
    your idea of what "most popular metrics" are might differ.

    These may or may not be good enough for you http://en.support.wordpress.com/stats/

    And just because WordPress is closely tied to Automattic and shows both Akismet and Jetpack in the AdminCP doesn't really make them "core", though I imagine they're well integrated, or at least would hope so.

  10. #10
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,834
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Why not be consistent and place it at the very bottom of the HTML where you place ALL JavaScript. If someone stays on your page for such a short time that the HTML doesn't fully download then they probably are not worth including in the count.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  11. #11
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,189
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    Good point. Even though Google says https://support.google.com/analytics...SetupChecklist
    3. Copy and place the code snippet
    Once you find the code snippet, copy and paste it into your web page, just before the closing </head> tag*. If your website uses templates to generate pages, enter it just before the closing </head> tag in the file that contains the <head> section.
    .....
    *One of the main advantages of the asynchronous snippet is that you can position it at the top of the HTML document. This increases the likelihood that the tracking beacon will be sent before the user leaves the page. It is customary to place JavaScript code in the <head> section, and we recommend placing the snippet at the bottom of the <head> section for best performance.
    I guess it depends on what you consider "best performance" to be.

  12. #12
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,834
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Mittineague View Post
    Good point. Even though Google says
    Google is wrong. with their statement about where JavaScript goes - unless they are still looking primarily at Netscape browser users.

    It is customary to place JavaScript code immediately before the </body> tag when targetting browsers other than Netscape 4 and earlier. That eliminates any need to test for whether the documenthas loaded or not.

    Of course it makes no difference to me where people place their Google Analytics code as I have that script blocked so that it never loads regardless of where people put it. So there page will load just as fast no matter where they put that call.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  13. #13
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    732
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    ok...well, placed in the header. seems to be working fine and causing no issues.
    Thank you all. And Mittineague for the jetpack info i'll keep it mind & perhpas try both on the next site so i can compare.
    D

  14. #14
    SitePoint Member
    Join Date
    Sep 2013
    Location
    Crawley, UK
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I add it to the specific pages I want to track (normally just the squeeze pages).

  15. #15
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    4
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I prefer it in the footer but i am using allinone seo pack plugin it gives an option for placing the google analytics code


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •