Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
5.2k views
in Q2A Core by
I have  posted a question like this before but I couldnt get any answers.

When I try to copy Google Analytics code, error 403 pops up. <script> code brings about the error, actually. Whenever I delete that part, its ok, yet when I add <script> 403 occurs.

I dont know what to do.
by
Your question is not clear, please explain in detail.....google analytics code should work without any issues on site.
by
Yes, normally it should but It doesn't. I copy the code and try to paste it <head> section in layout menu. However, when I save the settings  error 403 pops up.

It is because of the <script> code. If I remove that part it works fine, yet, this time,  code doesn't work. Therefore,  there is no way I can paste the analytics code.
 I have also tried analytics plugin which also doesn't work due to the same reason
by
Google analytics code is not for head section. You should not paste there. It should always go in footer section. Try again and let me know if you see issues.

admin-layout->Custom HTML at bottom of every page:
by
I have tried all of the sections including Custom HTML at bottom of every page, yet, still, 403 pops up.

I can give you my website's link if you think that it will help.
by
provide your website link, will check. also remove analytics code from header section. What are other plugins you are using on site?
by
simdunyasi.com/soru-cevap

Plugin List:
Akismet Spam Filter
AntiBot Captcha
Basic AdSense
Example Page
Facebook Login
On-Site-Notifications
XML Sitemap
by
can you disable below three plugins, add analytics code and check again.

Akismet Spam Filter
AntiBot Captcha
On-Site-Notifications
by
It wont work :(

In addition to this error, Users cannot ask a new question whose title begins with CC due to the same error. However, if they write CC at the end of the title no error pops up.
by
Exactly WHAT are you pasting and exactly WHERE are you pasting it?
by
http://www.simdunyasi.com/wp-content/uploads/52525.png

the section is called Custom HTML at bottom of every page in English. When I try to save this the error pops up. If I delete the <script> parts, no error show up. However, the code won't work that way.

2 Answers

+1 vote
by
selected by
 
Best answer

Q2A has nothing to do with this issue and based only in the information you've shared, you don't seem to be doing anything wrong. I'd rather ask for help to your hosing provider.

You also haven't explained much about the issue. For example, when do you get the 403 error? Immediately after you save the settings? What does the web browser's console log and network tab display?

Anyway, if you get a 403 error you are not being able to access the URL you're POSTing to when saving, which happens to be the same URL you were accessing with a GET.

So you have seriously messed with your web server configuration (or your hosting company has) or maybe there is some kind of ridiculous security setting that won't allow you to POST JavaScript code.

BTW, I don't think GoogleAnalytics has anything to do with this and I'm pretty sure this code would also fail:

<script>alert('Hello');</script>

If it works then you should ask your hosting provider why they don't allow your pages to contain a link to GoogleAnalytics, which is obviously ridiculous.

by
I get the error as soon as I save settings. It says ''403 Forbidden - Access to this resource on the server is denied!''

I don't think I have done anything that might have broken the codes. I used to get this error two years ago, as well. Then, I set up a new Q2A, yet it's still the same. Apparently, it is all about the hosting provider.

As you suggested, that code didn't work, as well.

Thanks for all your helping.
by
Best answer has already been selected so please follow the instructions. (Ask your hosting provider)
0 votes
by

i check in other hosting provider and i found the problem is the hosting iam sure 100%

...