Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Google AdSense Connection Problem

I created a Google adsense account and I got the following 

Qutoe:

[list]
[*]Copy the code below
[*]Paste it into the HTML of http://yourdomain.com, between the <head> and </head> tags
[*]Tick the box and click Finished when you've completed it
[/list]
Your AdSense code
<script data-ad-client="ca-pub-xxx111222333xxxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

I made tried to insert this code everywhere I thought it may work but with no use.
I tried to creat a panel with some help of previous old articles, but did not succeed .
So can we get some help from the developers by creating a plugin or a module for this important script?
Thank you
 
For Panels you need to enable PHP execution ( Admin > Security Settings ).

CodeDownload  
add_to_head('<script data-ad-client="ca-pub-xxx111222333xxxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>');



In other places you also need to echo the code when put under PHP sections. If it is a new account Google can take some time before Ads starts to display since they determine the relevancy of ads before serving them.

Our Developers prefer that you create a new panel file instead and add it. Create a directory under Infusions called adsense_panel add a file in it called adsense_panel.php
<?php
defined('IN_FUSION') || exit;
CodeDownload  
add_to_head('<script data-ad-client="ca-pub-xxx111222333xxxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>');



Save, and go to Panel Admin and add this newly created panel and enable it.
 
I created adsense_panel.php and created a panel and enabled PHP execution
but the ads did not appear on my site which was activated by google
This is the file content
=====================
<?php
defined('IN_FUSION') || exit;
add_to_head('<script data-ad-client="pub-xxx1234567890xxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>');
=====================
Any idea ?
Thank you
Try to just echo it.

<?php
defined('IN_FUSION') || exit;
echo '<script data-ad-client="pub-xxx1234567890xxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>';

Quote

Try to just echo it.

<?php
defined('IN_FUSION') || exit;
echo '<script data-ad-client="pub-xxx1234567890xxx" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>';

Sorry ...
What do you mean by (Try to just echo it.)
Do you mean to delete the panel and disable PHP execution?

Please , clearify
 
see my code.. add_to_head replaced with echo
 
According to your solution

echo '<script data  must replaced by
echo'<script data

Thank you
Do not use double quotes for javascript in PHP echo instruction.

So use: echo"<script data-ad-client = 'pub .....
 
Actually depends on user preference in JS, harder scripts that use ' for functions then you need to escape in \' etc ... for adsense it is perfectly fine as is. 
In fact, In javascript, you can use either single (') or double (") quotes and they behave the same. In PHP, it is different. Double quotes and single quotes aren't exactly the same.
Or do you know any other reason as to why it would not be ok there?
 
This is my adsense code I am using and it works:


add_to_head ("<script data-ad-client='ca-pub-xxxxxxxxxxxx' async src='https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'></script>");

But of course You can try it your own way.


 
Yes ,  exactly ... the adsense is working now on my site.
It worked through the adsense panel and I put the code in the theme_functions_include.php file.
Thank you very much All
Thread Information
Author
Replies
11 posts
Views
158 times
Last Post
Last updated on 22 days ago
Related Threads
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Falk, douwe_yntema, alqutob