WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Analytics does not detect the code (13 posts)

  1. pelesl
    Member
    Posted 6 years ago #

    I installed this into two different blogs I have on a dreamhost account. I can verify that if I go to the blogs and view the source, the google analytics code is there (at the bottom of the <head> section), but google analytics does not detect the code; it says "tracking unknown". I've tried all the tricks I could find, such as deactivating and reactivating the plugin, making sure I'm not logged in as administrator on the blog (I also told the plugin to go ahead and track the administrator), trying it from a different IP address, etc. The site http://sitescanga.com shows that the code is properly installed.

  2. pelesl
    Member
    Posted 6 years ago #

    Oh, I also made sure there was an http:// in front of the URL inside my google analytics profile. The only other thing worth mentioning is that the blogs are not on a root domain, that is, they are mydomain.com/blog1 and mydomain.com/blog2. This shouldn't be a problem, right? Any ideas?

  3. pelesl
    Member
    Posted 6 years ago #

    Google seems to recommend putting the code just above </body>. Is it being in the head making it impossible for google to find?

  4. whooami
    Member
    Posted 6 years ago #

    If google recommends it, than do it. We can conversate all day long all about it first, but why :)

  5. pelesl
    Member
    Posted 6 years ago #

    whooami: the plugin inserts the code in the blog pages for me. That's the whole point. Do you know of a way to tell it to put it somewhere else?

  6. whooami
    Member
    Posted 6 years ago #

    oh, Im sorry. My bad for not realizing you were using a plugin.

    if it were me, I would ditch the plugin, and edit my footer.php, putting in the code right before the closing </body> tag :)

  7. pelesl
    Member
    Posted 6 years ago #

    whooami: Interesting.... I disabled the plugin, and then did as you said, pasting the code from google analytics into the footer.php file. Google still says it can't find it, and I confirmed by viewing the source that it is in fact there. Does anyone knows if it still collects data even if the "status is unkown"?

  8. pelesl
    Member
    Posted 6 years ago #

    SHEEESH! There is a bug with Google Analytics. I have several accounts with root domains (that is, your site is domain.com or http://www.domain.com) which work fine with the URL typed in without the http:// and without the trailing slash. However, it seems that if the URL of your site is not a root domain, for example, www.domain.com/SiteIWantToTrack, it will not work if you type in http://www.domain.com/SiteIWantToTrack, you must add the trailing slash, like this: http://www.domain.com/SiteIWantToTrack/

    In the end, I'm not using the plugin, but I suspect there is no difference.

  9. erick_paper
    Member
    Posted 6 years ago #

    Having a plugin for this simple functionality is exactly why many WP blogs are so horridly slow. Just get the JS and toss it in your footer template for crying out loud.

    If you want a folder in your site to be tracked, then yes, a trailing slash is the way to do. The same file without a trailing slash could be a *page* on the site (without a file extension, which is common these days) and not a folder.

  10. averyfisher
    Member
    Posted 6 years ago #

    One problem I had getting this working was on the Google Analytics end. Make sure of the following:

    • URL in Google Analytics includes http://www.yourdomain.com/ (with training slash)
    • Default page is set to "index.php" in Google Analytics

    After doing these two (very obvious, but overlooked) things, Analytics started tracking my site without issue.

  11. Joost de Valk
    Member
    Posted 6 years ago #

    @erick_paper: The plugin actually takes care of stuff like outbound link tracking automatically, also the overhead of adding a piece of code through a hook is negligible, compared to loads of other plugins.

  12. peterfletcher38
    Member
    Posted 5 years ago #

    @joostdevalk Without reading the instructions properly I attempted to paste the whole of the JS code into the box for the site ID - duh. Once I found that it wasn't working I changed back to the site ID but Google Analytics still wasn't picking up the tracking code. I then did what @erick_paper suggested and Analytics now works fine. I appreciate there are a few things I'm going to be missing doing it this way so I'm wondering if you could give me a pointer about fixing up my blunder. Thanks in advance.

  13. Joost de Valk
    Member
    Posted 5 years ago #

    peterfletcher38: understandable, would love to know why the plugin didn't work for you though :)

Topic Closed

This topic has been closed to new replies.

About this Topic