#1
  1. No Profile Picture
    Banned
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    May 2015
    Posts
    1
    Rep Power
    0

    Add Google Analytics Code To Wordpress Website


    Hi

    I am new in seo field and want to promote my website. I am facing problem to add GA code in website, Please suggest me how to add.
  2. #2
  3. Not An Expert
    SEO Chat Hero (2000 - 2499 posts)

    Join Date
    Jan 2015
    Posts
    2,172
    Rep Power
    2033
    Hello and welcome to SEO Chat!

    This might be helpful: https://support.google.com/analytics.../1008080?hl=en

    What problems are you facing? Is there a specific error message or difficulty that you're having?

    I removed the link to your site from your post - I'm not sure how necessary it is. If a user asks for it though, please post it so that it isn't a hyperlink (www(dot)website.com or just website.com, for example.)
  4. #3
  5. Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Feb 2014
    Location
    Capital Region, NY
    Posts
    62
    Rep Power
    62
    WordPress can be tricky. There are many different ways to add GA code to a WordPress site. Obviously you want it on all pages, so it should go into the theme, directly.

    My favorite two methods are to use either Google Analytics by Yoast or Google Analyticator. Both plugins are quick and easy to install, have solid support behind it and allow you to have the GA code not inserted for when certain user types are logged in. Both also have a mini GA widget that goes into your Dashboard in WordPress.

    Sometimes a theme will allow you to ad GA (or any scripting code) into it. All of the Woo Themes and many paid themes for that matter have this ability.

    If you're a purist, you can always add the code via your header.php file in WordPress. You'd find this in:
    Code:
    (DocumentRoot)/wp-content/themes/(your-theme-name)/header.php

    Comments on this post

    • Will-O-The-Wisp agrees : Thanks Thom!
    --
    Thom Craver (@ThomCraver)
    VP Development & IT, Internet Marketing Ninjas
  6. #4
  7. Just a Photographer
    SEO Chat Adventurer (500 - 999 posts)

    Join Date
    May 2011
    Location
    Atwater, CA
    Posts
    887
    Rep Power
    1896
    I create a 'mu-plugins' (/wordpress/wp-content/mu-plugins/) and I add this to that file:

    Code:
    /** 
    * Adds GA Code in Very Bottom of Head
    */
    add_action( 'wp_head', 'analytic_code', 100 );
    function analytic_code() { ?>
    
    <script>
    	
    	your GA code here
    
    </script>
    
    <?php }
    FWIW, A 'mu-plugins' ("Must Use") a plugin that is always active: Creating a custom functions plugin for end users
    - Mike

    Jack of all trades, master of none.
  8. #5
  9. Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Feb 2014
    Location
    Capital Region, NY
    Posts
    62
    Rep Power
    62
    Excellent suggestion.

    To add to that:

    This can also be done in child themes in your functions.php file.

    Further you can make it into a shortcode, in case there were ever a page you didn't want to include your GA code on:

    Code:
    add_shortcode('gacode', 'analytic_code');
    --
    Thom Craver (@ThomCraver)
    VP Development & IT, Internet Marketing Ninjas
  10. #6
  11. SEO Since 97
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Mar 2011
    Location
    Arizona
    Posts
    7,685
    Rep Power
    4753
    This can also be done in child themes in your functions.php file.
    I'm glad you mentioned that, if one adds it to the theme it can be lost the next time wp updates.
    If your going to make any changes in the theme make sure you create a child theme.
    creating a child theme in WP. This is the best way to modify existing themes.
  12. #7
  13. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Mar 2015
    Posts
    9
    Rep Power
    0
    May i know you using which content management system? If you using wordpress then it is easy. they have plugin for this. I use all in one seo, it is good to use. If you are not wordpress, try to content the person who do your website. Ask them help you to verify it.

Similar Threads

  1. What should i do for Google Analytics Code
    By seoraviraj in forum Google Optimization
    Replies: 8
    Last Post: Feb 6th, 2013, 07:11 AM
  2. Replies: 0
    Last Post: Nov 7th, 2012, 12:52 AM
  3. New tracking code for Google Analytics
    By seoprofs in forum Analytics Analysis
    Replies: 8
    Last Post: Jan 23rd, 2008, 11:40 AM
  4. Google analytics Track code?
    By seo tk in forum Analytics Analysis
    Replies: 2
    Last Post: Nov 19th, 2007, 10:53 AM
  5. Google Analytics Code
    By kandpal in forum Google Optimization
    Replies: 5
    Last Post: Aug 18th, 2006, 01:50 AM

IMN logo majestic logo threadwatch logo seochat tools logo