Adsense code problem Topic is solved

General questions relating to Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Locked
vhfmac
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Tue Sep 02, 2008 4:03 pm
Contact:

Adsense code problem

Post by vhfmac » Mon Aug 26, 2019 6:38 pm

After entering HTML CODE from google ADSENSE into an article, the code gets changed when I click back to EDITOR TAB and save it. If I save it while still in the CODE TAB, the ad displays fine.

GOOGLE CODE:

Code: Select all

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-9152011078578747"
     data-ad-slot="1922181214"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
CHANGED GOOGLE CODE:

Code: Select all

<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" type="text/javascript"></script>
<p>&nbsp;</p>
<script type="text/javascript">
	(adsbygoogle = window.adsbygoogle || []).push({});
</script>
I use the JCE PRO editor.
Does anyone know what is going on? Thanks....
Last edited by mandville on Mon Aug 26, 2019 10:36 pm, edited 1 time in total.
...........................................
MéxicoMac

User avatar
john-doe
Joomla! Ace
Joomla! Ace
Posts: 1001
Joined: Tue Apr 19, 2011 7:39 pm
Location: Colombia
Contact:

Re: ADSENSE CODE PROBLEM

Post by john-doe » Mon Aug 26, 2019 7:18 pm

You need to set the adsense code through a module or plugin or place it directly on the template's index.php.
If you place the code into an article the editor strips the contents, that's why looks different.

Why do you need the Adsense code in the article instead of the Whole site?
www.aldemar-hernandez.com - Custom templates and design services.

vhfmac
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Tue Sep 02, 2008 4:03 pm
Contact:

Re: ADSENSE CODE PROBLEM

Post by vhfmac » Mon Aug 26, 2019 10:18 pm

I need to have different Google Ads on various article pages. It has always worked before??
I know the editor is striping the code. Is there any way to prevent this? Mac 8)
...........................................
MéxicoMac

vhfmac
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Tue Sep 02, 2008 4:03 pm
Contact:

Re: Adsensce code problem

Post by vhfmac » Mon Aug 26, 2019 11:17 pm

All my articles with google code now only show this: :(

<script type="text/javascript">
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

An ad shows, but does not send google my account number for remunerations. :(

See: https://www.costalegre.ca/index.php/tow ... tenacatita
Now I'm going to have to dump all the ad code on every page!! :(

Anyone else having this issue? Mac 8)
...........................................
MéxicoMac

User avatar
mandville
Joomla! Master
Joomla! Master
Posts: 15058
Joined: Mon Mar 20, 2006 1:56 am
Location: The Girly Side of Joomla in Sussex

Re: Adsense code problem

Post by mandville » Tue Aug 27, 2019 12:00 am

right, so HOW exactly did it work before? why are you not using a module for showing this with a different channel per advert. why on earth would you need a different advert for each article? i use phoca gae and it works fine., if you tie that in with Modules Anywhere even better.
so i dont think anyone else is having this issue as they realise how simple the solutions (see above paragraph) actually is. or ask the adsense chat.
HU2HY- Poor questions = Poor answer
Un requested Help PM's will be reported, added to the foe list and possibly just deleted
{VEL Team Leader}{TM Auditor }{ Showcase & Security forums Moderator}

User avatar
john-doe
Joomla! Ace
Joomla! Ace
Posts: 1001
Joined: Tue Apr 19, 2011 7:39 pm
Location: Colombia
Contact:

Re: ADSENSE CODE PROBLEM

Post by john-doe » Tue Aug 27, 2019 12:01 am

vhfmac wrote:
Mon Aug 26, 2019 10:18 pm
I need to have different Google Ads on various article pages. It has always worked before??
I know the editor is striping the code. Is there any way to prevent this? Mac 8)
I suggest that you do a different approach.

First get the module Phoca GAE (Phoca Google AdSense Easy)
Second get the component Modules Anywhere
Third since you need to apply each different conde to each article First set Different modules for the blocks but don't assign a position, so once you save it appear as "none". Then in your article you see the button of Insert Module (from Modules Anywhere) and you select the module, now it appears as a short code. Save and it should work.
www.aldemar-hernandez.com - Custom templates and design services.

User avatar
john-doe
Joomla! Ace
Joomla! Ace
Posts: 1001
Joined: Tue Apr 19, 2011 7:39 pm
Location: Colombia
Contact:

Re: Adsense code problem

Post by john-doe » Tue Aug 27, 2019 12:03 am

mandville wrote:
Tue Aug 27, 2019 12:00 am
right, so HOW exactly did it work before? why are you not using a module for showing this with a different channel per advert. why on earth would you need a different advert for each article? i use phoca gae and it works fine., if you tie that in with Modules Anywhere even better.
so i dont think anyone else is having this issue as they realise how simple the solutions (see above paragraph) actually is. or ask the adsense chat.
LOL Actually I mentioned both Components, but i agree with you. I don't understand why set a different Ad block for each article when a Simple module in a standard position will do enough (unless is related to a specific section/ article content related)
www.aldemar-hernandez.com - Custom templates and design services.

User avatar
mandville
Joomla! Master
Joomla! Master
Posts: 15058
Joined: Mon Mar 20, 2006 1:56 am
Location: The Girly Side of Joomla in Sussex

Re: Adsense code problem

Post by mandville » Tue Aug 27, 2019 12:04 am

and your right click blocker was disabled in two mouse clicks. useless - perhaps thats clashing your money making sheme
HU2HY- Poor questions = Poor answer
Un requested Help PM's will be reported, added to the foe list and possibly just deleted
{VEL Team Leader}{TM Auditor }{ Showcase & Security forums Moderator}

vhfmac
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Tue Sep 02, 2008 4:03 pm
Contact:

Re: Adsense code problem

Post by vhfmac » Tue Aug 27, 2019 8:15 pm

OK, I did set up some CUSTOM modules for the Adsense code. For each one I named a new position Ad1, Ad2, etc. and posted the google code. Then I added {loadposition Adsense} to the bottom of each article.
Loadposition worked ok, as the Ads displayed, but when I go back and view it the code is still stripped away. :(
I will try some of your suggestions later.
Thanks guys,
...........................................
MéxicoMac

User avatar
sozzled
Joomla! Master
Joomla! Master
Posts: 10420
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Adsense code problem

Post by sozzled » Tue Aug 27, 2019 8:19 pm

“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)
Testing J! 3.10: https://sintranet.enduring.com.au

User avatar
john-doe
Joomla! Ace
Joomla! Ace
Posts: 1001
Joined: Tue Apr 19, 2011 7:39 pm
Location: Colombia
Contact:

Re: Adsense code problem

Post by john-doe » Tue Aug 27, 2019 8:24 pm

vhfmac wrote:
Tue Aug 27, 2019 8:15 pm
OK, I did set up some CUSTOM modules for the Adsense code. For each one I named a new position Ad1, Ad2, etc. and posted the google code. Then I added {loadposition Adsense} to the bottom of each article.
Loadposition worked ok, as the Ads displayed, but when I go back and view it the code is still stripped away. :(
I will try some of your suggestions later.
Thanks guys,
NO, NO, NO!

Don't put the code on Custom Modules! Try to put them in Phoca GAE Modules and then Try!
www.aldemar-hernandez.com - Custom templates and design services.

vhfmac
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Tue Sep 02, 2008 4:03 pm
Contact:

Re: Adsense code problem

Post by vhfmac » Tue Aug 27, 2019 8:58 pm

Joomla extensions installer is unable to find install package for Phoca GAE.
I will try again later. Tnks 8)
...........................................
MéxicoMac

User avatar
john-doe
Joomla! Ace
Joomla! Ace
Posts: 1001
Joined: Tue Apr 19, 2011 7:39 pm
Location: Colombia
Contact:

Re: Adsense code problem

Post by john-doe » Tue Aug 27, 2019 9:00 pm

vhfmac wrote:
Tue Aug 27, 2019 8:58 pm
Joomla extensions installer is unable to find install package for Phoca GAE.
I will try again later. Tnks 8)
Please tell me that you are not installing via "Install from Web"

If that is the case: Find it on extensions.joomla.org or go directly to phoca.cz
www.aldemar-hernandez.com - Custom templates and design services.

vhfmac
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Tue Sep 02, 2008 4:03 pm
Contact:

Re: Adsense code problem

Post by vhfmac » Tue Aug 27, 2019 9:05 pm

I see it is joomla updateable, so I will download it from their site. 8)
...........................................
MéxicoMac

vhfmac
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Tue Sep 02, 2008 4:03 pm
Contact:

Re: Adsense code problem

Post by vhfmac » Wed Aug 28, 2019 12:19 am

Ok, I downloaded PhocaGAE extension and it works fine. :)
I did figure a work around for those using JCE Editor Pro. Just Turn Off the VALIDATE HTML setting before adding the google code to an article. The setting is here:
Components/JCE editor Pro/Control Panel/Editor Profiles/Default Profile/Editor Parameters/Validate html-NO
Now, set up an new article and add the google code and save it.
THEN go back and turn the Validate Html setting back ON.
Anybody have any thoughts on doing this? 8)
...........................................
MéxicoMac


Locked

Return to “General Questions/New to Joomla! 3.x”