• How do you add your GA code to your site without a plugin and without putting your UA-# right in your header or footer file??

    I have had to shut down my old account due to spam bots and multiple hackers hijacking my GA account.

    I have started a new account, but nothing seems to be working. I have tried Google’s <?php include_once(“analyticstracking.php”) ?> and created a file with my GA code in it – but this doesn’t work on WordPress.

    Any suggestions?

Viewing 10 replies - 1 through 10 (of 10 total)
  • I am not aware of any security concerns related to Google Analytics code. Can you please share with us why you have this concern?

    To answer the question, most use a plugin such as Google Analytics by Yoast, or they edit the header.php file and add the code. This assumes that header.php is the header file used throughout the site. Since custom header files can be used, it would need to be added to each.

    It needs to be added somewhere and your choices are as noted above.

    Note that edits to parent themes typically are lost on theme updates.

    You also want to setup your Google Webmaster Tools and submit the robots.txt and sitemap to Google (and don’t forget that there are other search engines). And, of course, also note that the process of indexing and then listing your site takes time and that content is King!

    You also want to make sure you have permalinks enabled and to follow good SEO rules. A very popular plugin for that is WordPress SEO by Yoast.

    Thread Starter patientos

    (@patientos)

    Hi there,
    I had my google analytics code pasted into my header.php file and the UA-number was stripped by hundreds of bots and they inserted this UA-number on their sites. Their pages began showing up in my Google analytics by the hundreds as OUR pages…..

    I tried yoast and a few other plugins to alleviate this issue (with a new property) and my UA number was still being stripped and used for spam.

    As noted, please also look at Google Webmaster Tools where you find out how to verify site ownership.

    Also, I am still not convinced that your UA number was mis-used, I would believe they may have stolen your Google credentials and mis-used the account. If this was happening it would be a rather big issue (for us all), and since I have not heard of this I am going keep my suggestions and ask you further review this issue.

    Please note that malware on your PC, tablet, phone or any device you use to log into sites can steal your passwords. Keep them all secure anytime you want to securely access websites.

    Thread Starter patientos

    (@patientos)

    While I appreciate the information you are providing, I’m disheartened by your lack of actual assistance.

    I spoke to Google Analytics support, and after an extensive review of the spam apperaing in my account, they noted that our UA-number had been stripped and recommended using more secure measures on WordPress.

    I turned to WordPress forums to get some insight, and am apparently not going to get any answers here either.

    How do you add your GA code to your site without a plugin and without putting your UA-# right in your header or footer file??

    I have had to shut down my old account due to spam bots and multiple hackers hijacking my GA account.

    I have started a new account, but nothing seems to be working. I have tried Google’s <?php include_once(“analyticstracking.php”) ?> and created a file with my GA code in it – but this doesn’t work on WordPress.

    Any suggestions?

    due to spam bots and multiple hackers hijacking my GA account.

    We cannot assist you with issues directly related to your GA account other than the basic advise given.

    Nothing in your post has noted that you (or anyone) believes the issue was with your WordPress website being compromised.

    Also, since everyone that is using GA tools has the UA # shown in the source code (just review almost any website), I am still unconvinced that you:

    1. Actually ‘Spoke to Google Analytics Support‘. I am however aware of their community forums where folks like us can try to help.

    2. Understand the issue in full.

    That makes answering here quite difficult.

    It may be in your best interest to hire an expert or try to start again with the issues as related to WordPress (and only WordPress).

    We do want to help, that is why we are here…

    Thread Starter patientos

    (@patientos)

    I’m not sure what else I should provide you here. You seem hell-bent on not actually helping.

    Yes, I spoke directly with support from Google Analytics. I spent a few hours with them, both on the phone and via email.

    Clearly me stating that I have an issue is not proof enough that ther is an issue – so why even have forums?

    The issue itself is not with GA, but with the code used in PHP for my header file.

    I do understand the issue. The fact that you refused to help me from step one and your posts basically stating ‘You’re an idiot, I suggest you figure it out for yourself – I will not be giving you any suggestions,’ indicates that this is going nowhere. I’d appreciate if you stopped replying and let someone else in on the conversation who would actually be willing to listen to the problem, ask relevant questions, and provide suggestions of value.

    Since I have never found a phone number for Google Analytics Phone Support, I am intrigued that you were able to. Care to share the phone support number here?

    I will then bow out as asked.

    Thread Starter patientos

    (@patientos)

    If you persist, you will find a way.

    I originally accessed via a Google Adwords chat. From there I received emails from Google as well as phone calls. I was never provided with a number, because I suspect they would like to keep it that way.

    So you are running Google Adwords on the site?

    Thread Starter patientos

    (@patientos)

    I was, but the campaigns have all been paused for some time. Adwords has been disabled on WordPress.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Add Google Analytics code to wordpress’ is closed to new replies.