+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: Smarty literal and adsense issue

  1. #1
    Senior Member
    Join Date
    Jun 2016
    Posts
    185

    Question Smarty literal and adsense issue

    I have added adsense via smart in a

    {literal} {/literal}

    When i add the script code for some reason it ads " to the script instead of ". Which i think is making my ads not showing. (and no, my adsense is not blocked to my domain or blocked at all.)

    And i get a console error too which is:

    Mixed Content: The page at 'https://MYSITE/' was loaded over HTTPS, but requested an insecure script 'http://MYSITE/"//pagead2.googlesyndication.com/pagead/show_ads.js"/'. This request has been blocked; the content must be served over HTTPS.

  2. #2
    Hello Fadil,

    I think your site working with secure https protocol. But you want to load 3rd party script with http. Change it to https too and all should be ok.
    Another question: where did you add your Adsense code? In a file or through Admin Panel >> Content Boxes?
    Viktor,
    Flynax technical department,
    Best wishes.

  3. #3
    Senior Member
    Join Date
    Jun 2016
    Posts
    185
    Via admin content boxes.

    This is the original code

    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- ST Responsive -->
    <ins class="adsbygoogle"
    style="display:block"
    data-ad-client="ca-pub-**************"
    data-ad-slot="**********"
    data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>

    And this is what it does after i save it:

    {literal}
    <script src=&quot;//pagead2.googlesyndication.com/pagead/show_ads.js&quot;></script>
    <!-- ST Responsive -->
    <ins class=&quot;adsbygoogle&quot;
    style=&quot;display:block&quot;
    data-ad-client=&quot;ca-pub-**************&quot;
    data-ad-slot=&quot;*************&quot;
    data-ad-format=&quot;auto&quot;></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    {/literal}

    I think the &quot; gives me errors?

    And there is no way to add https to that code. And it is added as in this link https://support.google.com/adsense/answer/10528?hl=en

  4. #4
    Senior Member
    Join Date
    Jun 2016
    Posts
    185
    And in the error it ads my domain to the link

    The page at 'https://MYSITE/' was loaded over HTTPS, but requested an insecure script 'http://MYSITE/&quot;//pagead2.googlesyndication.com/pagead/show_ads.js&quot;/'. This request has been blocked; the content must be served over HTTPS.

    i believe this should be 'https://pagead2.googlesyndication.com/pagead/show_ads.js'/

    and not 'http://MYSITE/&quot;//pagead2.googlesyndication.com/pagead/show_ads.js&quot;/

  5. #5
    Senior Member
    Join Date
    Jun 2016
    Posts
    185
    i have installed new version 4.6.2

  6. #6
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    977
    Hello Fadil,

    All third-part links that you use in content boxes or inside the tpl code you should specify with 'https' manually

  7. #7
    Senior Member
    Join Date
    Jun 2016
    Posts
    185
    Did it. Now it does this

    Mixed Content: The page at 'https://MYDOMAIN/' was loaded over HTTPS, but requested an insecure script 'http://MYDOMAIN/&quot;https://pagead2.googlesyndication.co...ogle.js&quot;/'. This request has been blocked; the content must be served over HTTPS.

    it ads again http://MYDOMAIN/&quot; in front of link

    and why all the &quot; in the code. that kills it also

  8. #8
    Quote Originally Posted by Rudi View Post
    Hello Fadil,

    All third-part links that you use in content boxes or inside the tpl code you should specify with 'https' manually

    Hello Rudi,

    It is not true
    will be better use links without http or https
    correct using will be: //pagead2.googlesyndication.com/pagead/js/adsbygoogle.js and Fadil did it already.


    Hello Fadil,

    You need some changes in code.
    Open file: ftp://admin>>controllers>>blocks.inc.php

    find code:
    PHP Code:
    Only registered members can view the code
    and replace to:
    PHP Code:
    Only registered members can view the code
    then find code:
    PHP Code:
    Only registered members can view the code
    and replace to:
    PHP Code:
    Only registered members can view the code
    save and edit box with google adsense again.
    Viktor,
    Flynax technical department,
    Best wishes.

  9. #9
    Senior Member
    Join Date
    Jun 2016
    Posts
    185
    Works perfect now and no errors!

    Thank you very much!!

  10. #10
    Can we use google adsense in banner plugin? I wanna put banner in grid position. And haven't had success copy ads to html box.

+ Reply to Thread