1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Ways to Place Google Analytics Tracking Code in WordPress Site

Discussion in 'WordPress' started by AdequateContent, Apr 2, 2018.

  1. #1
    I'm looking for ways to add Google Analytics tracking code in WordPress site.

    - First of all, I want to place tracking code without the use of any plugins.
    - My theme has no any such feature pre-installed in theme options/panel.
    - I know one way - Adding tracking code in header.php before </head>. But after each theme update it's gone and sometimes I forgot to put tracking code back again and I miss data in GA.

    Is there any other way you guys are using/know, please let me know.
     
    AdequateContent, Apr 2, 2018 IP
  2. RomanEpo

    RomanEpo Active Member

    Messages:
    127
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    78
    #2
    I think you can create external tracking script and add script link in header.php file like as plugin algorithm.or you can also disable update theme for avoiding update fast repeatedly.
     
    RomanEpo, Apr 3, 2018 IP
  3. JoeSpirit

    JoeSpirit Well-Known Member

    Messages:
    1,066
    Likes Received:
    417
    Best Answers:
    5
    Trophy Points:
    133
    #3
    I'm not personally aware of a way to do that without re-editing after every update unless you use a plugin.
     
    JoeSpirit, Apr 3, 2018 IP
  4. andriusk

    andriusk Well-Known Member

    Messages:
    367
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    140
    #4
    You can add widget with code at the end of your footer. It worked earlier for me. I'm not sure if it works now.
     
    andriusk, Apr 3, 2018 IP
  5. AdequateContent

    AdequateContent Active Member

    Messages:
    31
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    65
    #5
    I'll try. Thank you very much for your suggestion.
     
    AdequateContent, Apr 4, 2018 IP
  6. AdequateContent

    AdequateContent Active Member

    Messages:
    31
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    65
    #6
    I tried it Today morning and it's not working now. :(
     
    AdequateContent, Apr 9, 2018 IP
  7. Sumit_Singh

    Sumit_Singh Well-Known Member

    Messages:
    716
    Likes Received:
    64
    Best Answers:
    6
    Trophy Points:
    100
    #7
    Paste the tracking code in the footer part is the old way to add tracking code to the website.
    How to add it?
    Go to your DashBoard
    Go to Appearance Section
    Click on Editor
    Click on header.php file below the templates section
    Paste it after the <body> tag.
    <body <?php  body_class ();  ?>>
    Paste Analytics code here
    <script>
    --------
    --------
    ------
    </script>
    Code ended here
    Code (markup):
    Don't Forget to take BackUp first.
    Hope this will help you.
     
    Sumit_Singh, Apr 9, 2018 IP
  8. AdequateContent

    AdequateContent Active Member

    Messages:
    31
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    65
    #8
    But in this way, we need to add tracking code again after updating the theme. That's what I don't want to do.
     
    AdequateContent, Apr 9, 2018 IP
  9. Sumit_Singh

    Sumit_Singh Well-Known Member

    Messages:
    716
    Likes Received:
    64
    Best Answers:
    6
    Trophy Points:
    100
    #9
    If after updating there is need to add it again so I recommend you to install the plugin for the same.
     
    Sumit_Singh, Apr 9, 2018 IP
  10. AdequateContent

    AdequateContent Active Member

    Messages:
    31
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    65
    #10
    Yes, I think it's the only way to do that. Anyways, thanks for your help and taking time to provide steps. Have a great buddy!
     
    AdequateContent, Apr 9, 2018 IP
  11. andrewterrol

    andrewterrol Well-Known Member

    Messages:
    343
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #11
    On our website we use a plugin called "Insert headers and footer" by WPbeginner. And in it we just place the Google Analytics and the Google Tag Manager code. The plugin and Google Analytics were installed by the Analytics Help agency that manages our Google Analytics install.
     
    andrewterrol, Apr 15, 2018 IP
  12. blueink02

    blueink02 Member

    Messages:
    77
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    43
    #12
    Using a plugin is safe and better way to use Analytics code.
     
    blueink02, May 30, 2018 IP
  13. Harshal shah

    Harshal shah Active Member

    Messages:
    126
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    65
    #13
    Hello,

    Hope you are doing well. These are the Ways to place Google analytics tracking Code in WordPress Site

    - Put your google analytics code in header.php between <head> and </head> tag.
    - Another way is to upload analytics code file in hosting
     
    Harshal shah, Oct 10, 2018 IP