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.

Unable to get plugin functioning

Discussion in 'Better Analytics' started by EMH333, May 10, 2017.

  1. #1
    I have configured Better Analytics to my liking and I love all the options however I ran into an issue. It seems that there is a problem on the client side JavaScript so it is encountering a type error and not correctly sending hits. The error is as follows
    SEMrush
    TypeError: BetterAnalytics._BA is undefined[Learn More] loader.php:1:168
    __construct/< http://www.mywebsite.com/wp-content/plugins/better-analytics/js/loader.php:1:168
    i http://www.mywebsite.com/wp-includes/js/jquery/jquery.js:1:27444
    add http://www.mywebsite.com/wp-includes/js/jquery/jquery.js:1:27748
    n.fn.ready http://www.mywebsite.com/wp-includes/js/jquery/jquery.js:1:29796
    __construct http://www.mywebsite.com/wp-content/plugins/better-analytics/js/loader.php:1:146
    BetterAnalytics.BA http://www.mywebsite.com/wp-content/plugins/better-analytics/js/loader.php:1:73
    <anonymous> http://www.mywebsite.com/wp-content/plugins/better-analytics/js/loader.php:2:3072
     
    Solved! View solution.
    EMH333, May 10, 2017 IP
    SEMrush
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,207
    Likes Received:
    2,584
    Best Answers:
    457
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    Any chance you can post the URL of your site so I can take a look?
     
    digitalpoint, May 11, 2017 IP
  3. EMH333

    EMH333 Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    www.ethohampton.com
    (and yes it is still happening)
     
    EMH333, May 14, 2017 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,207
    Likes Received:
    2,584
    Best Answers:
    457
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    It looks like no JavaScript is loading on your site because your site is setup for HTTPS, but you are accessing it via HTTP. It appears to work fine when you go to the secure version of your site: https://www.ethohampton.com/

    Your server is setup to not allow "cross-origin" requests, so it's not going to work when you are on the non-secure version but it's trying to request secure versions of JavaScript.
     
    digitalpoint, May 15, 2017 IP
  5. EMH333

    EMH333 Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    Yes, you are correct that it will not load correctly if you access via HTTP. I am fine with that because Google knows to send people to the HTTPS version. However, the error still occurs with HTTPS, see screenshot below. I will note that the screen shot is from chrome which gives sightly more information about the issue (I was originally using Firefox). Thank you for your help!
    Screenshot from 2017-05-15 21-54-50.png
     
    EMH333, May 15, 2017 IP
  6. #6
    Can you try disabling Rocket Loader in Cloudflare by chance? I've seen Rocket Loader mess up quite a few things with JavaScript (unrelated to Better Analytics, never tried it with BA).

    Rocket Loader is a beta feature of Cloudflare and it messes up a lot of things related to JavaScript loading properly.

    You can find the setting under the "Speed" section of your Cloudflare control panel. Doesn't hurt just to try it to see if that's the culprit before digging deeper.
     
    digitalpoint, May 16, 2017 IP
  7. EMH333

    EMH333 Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #7
    That does seem to be the issue, I am currently on my phone so I can't 100% confirm however it did show a real time view. From your point of view you could try something from this article(https://support.cloudflare.com/hc/en-us/articles/200169436-How-can-I-have-Rocket-Loader-ignore-my-script-s-in-Automatic-Mode-), could be a quick fix although not sure if it's possible. I will fill a report with Cloudflare and see what they have to say. Thank you so much for your help! When I get home, I will confirm there are no more errors and keep you updated. Thanks again!
     
    EMH333, May 16, 2017 IP
  8. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,207
    Likes Received:
    2,584
    Best Answers:
    457
    Trophy Points:
    710
    Digital Goods:
    29
    #8
    Ya, I'll do some digging and see if I can figure out what the underlying issue is with Rocket Loader. I keep it disabled on all my sites normally because it's beta and also because I never wanted an algorithm to try and load things better than I know I can. haha

    But I will look into it and see if there's a way to workaround whatever the issue might be.
     
    digitalpoint, May 16, 2017 IP
  9. EMH333

    EMH333 Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #9
    I can confirm that disabling Rocket Loader on Cloudflare seems to have fixed the issue. Thank you for your help and I hope we can prevent future situations like this from happening.
     
    EMH333, May 16, 2017 IP