Post by agentjr » Fri Feb 07, 2020 10:15 pm

Hi

I've just opened a Google Adsense account and now have the code to copy and paste "under my header" so that Adsense can verify my website.

I've gone into Modules/HTML Content and selected Code View.

The code copied and pasted is:
<script data-ad-client="ca-pub-5069328492041911" async src="https://pagead2.googlesyndication.com/p ... "></script>

BUT, when I save it and go back into it, Opencart has automatically changed the code to this:
<script data-ad-client="ca-pub-5069328492041911" async="" src="https://pagead2.googlesyndication.com/p ... ygoogle.js" data-checked-head="true"></script>

(adding the data-checked-head="true" part)

So of course Adsense doesnt recognise the code and wont work.

Can anyone help to resolve this please, in simple terms as I have very little IT experience?

Many thanks in advance.

Newbie

Posts

Joined
Sun Dec 06, 2015 9:47 pm

Post by cyclops12 » Fri Feb 07, 2020 10:22 pm

Have you tried going into code view, entering your code then switching out of code view and then saving it

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by agentjr » Fri Feb 07, 2020 10:48 pm

Hi,

Yes, I've tried that. It doesn't matter how I save it, it keeps adding the extra bit of code when I go back into it. Really annoying.

Newbie

Posts

Joined
Sun Dec 06, 2015 9:47 pm

Post by agatha65 » Sat Feb 08, 2020 3:09 am

You can't add javascript or php with html module.
Just add the code with an ocmod modificator, before the body closing tag in the footer template.

Suppliers Module - XML, CSV, XLS Product Feed Import and Update
Rich Snippets | Facebook Open Graph Meta Tags | WebP Images
Image


User avatar
Active Member

Posts

Joined
Fri Mar 16, 2012 10:18 am
Location - Canada, QC

Post by agentjr » Tue Feb 11, 2020 5:11 pm

Thanks for your response which is appreciated, but I have no website experience, as just a beginner, so I don't know what any of that means?

Newbie

Posts

Joined
Sun Dec 06, 2015 9:47 pm

Post by melvin16 » Sat Jan 30, 2021 1:55 pm

Hi agentjr,

First you must download Ads.txt from your Google Adsense account, then upload into your domain website.
Then you must add your Google Adsense script
<script data-ad-client="ca-pub-5069328492041911" async src="https://pagead2.googlesyndication.com/p ... "></script>
on your own website at your cpanel ------> public_html>catalog>view>theme>(default or what ever you use themes)>template>common>header.twig .....you must add your Adsense script between <head>....</head>.
After that you must wait for 24 hours to let Google Adsense learning your website structure for the best ads positions, next morning you Google Adsense will be active on your website.
Trust me, I already have same problem as you and resolved. I hope you success to modify your Opencart (DO NOT FORGET TO BACKUP YOUR OPENCART FIRST, BEFORE MAKE ANY MODIFICATIONS).

Kindly regards,
melvin16

User avatar
Newbie

Posts

Joined
Sat Nov 08, 2014 12:52 am

Post by paulfeakins » Mon Feb 08, 2021 5:44 pm

Give us the URL so we can see what you've done ...

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by websiteworld » Wed Mar 30, 2022 8:34 am

Any updates? I'm wanting to add this to some out of stock individual products. It won't even allow it to be inserted via MySQL WorkBench.

User avatar
New member

Posts

Joined
Thu Oct 18, 2012 3:11 am


Post by wedevlops.com » Tue Aug 09, 2022 2:33 pm

I was looking around the forum but there is no clear answer so here is the step-by-step guide on how to input google Adsense in Opencart. https://www.youtube.com/watch?v=oFkobq6jo7U

User avatar
Newbie

Posts

Joined
Fri Feb 05, 2021 1:23 pm

Who is online

Users browsing this forum: No registered users and 72 guests