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.
    SEMrush
     
    AdequateContent, Apr 2, 2018 IP
    SEMrush
  2. RomanEpo

    RomanEpo Member

    Messages:
    82
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    43
    #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 Active Member

    Messages:
    447
    Likes Received:
    57
    Best Answers:
    2
    Trophy Points:
    53
    #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:
    360
    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 Member

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

    AdequateContent Member

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

    Sumit_Singh Active Member

    Messages:
    327
    Likes Received:
    19
    Best Answers:
    2
    Trophy Points:
    55
    #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 Member

    Messages:
    28
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    35
    #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 Active Member

    Messages:
    327
    Likes Received:
    19
    Best Answers:
    2
    Trophy Points:
    55
    #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 Member

    Messages:
    28
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    35
    #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 Active Member

    Messages:
    339
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #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 at 8:25 AM IP