Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(ads): AdSense script for non-profit users #20

Open
Kristinita opened this issue Jan 27, 2019 · 0 comments
Open

bug(ads): AdSense script for non-profit users #20

Kristinita opened this issue Jan 27, 2019 · 0 comments

Comments

@Kristinita
Copy link
Owner

1. Summary

Our Custom Search have a non-commercial status, but when any Internet user visit page with our Custom Search form, Google send request to https://cse.google.com/adsense/search/async-ads.js AdSense script.

asyns-ads script

This creates problems.

2. Example

Source of our search form:

<!-- HTML5 validation, see:
    https://productforums.google.com/d/msg/customsearch/XE-cs3_oVuY/ohwVpwEUAgAJ and https://developers.google.com/custom-search/docs/element#html5 -->
    <div class="gcse-search" data-enableHistory="true" data-enableAutoComplete="true" data-autoCompleteMaxCompletions="10" data-enableOrderBy="false"></div>
do ->
    cx = '013024336414733191742:sps98skj394'
    gcse = document.createElement('script')
    gcse.type = 'text/javascript'
    gcse.async = true
    gcse.src = 'https://cse.google.com/cse.js?cx=' + cx
    s = document.getElementsByTagName('script')[0]
    s.parentNode.insertBefore gcse, s
    return
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8"/>
        <title>
            GCSE form example
        </title>
        <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/coffee-script/1.1.2/coffee-script.min.js"></script>
        <script type="text/coffeescript">
                do ->
                    cx = '013024336414733191742:sps98skj394'
                    gcse = document.createElement('script')
                    gcse.type = 'text/javascript'
                    gcse.async = true
                    gcse.src = 'https://cse.google.com/cse.js?cx=' + cx
                    s = document.getElementsByTagName('script')[0]
                    s.parentNode.insertBefore gcse, s
                    return
            </script>
    </head>
    <body>
        <!-- HTML5 validation, see:
                https://productforums.google.com/d/msg/customsearch/XE-cs3_oVuY/ohwVpwEUAgAJ and https://developers.google.com/custom-search/docs/element#html5 -->
        <div class="gcse-search" data-enableHistory="true" data-enableAutoComplete="true" data-autoCompleteMaxCompletions="10" data-enableOrderBy="false">
        </div>
    </body>
</html>

3. Problem 1 — Non-commercial

Control panel of my Custom Search:

(Sorry, I can't find, how I can switch language in Control Panel to English; please, tell me, if you know)

Control Panel

Ваша поисковая система получила статус некоммерческой СПП. Можно удалить рекламу.

Translate:

Your Search Engine have a non-commercial. You can remove ads.

I read «Information for non-profits» in official Custom Search Help. Citation:

If you are a nonprofit, government agency, or a school looking for high quality, customizable search experiences for your site, organization, or school, we are excited to announce that Custom Search Engine is now integrating with Google For Nonprofits, https://www.google.com/nonprofits/, and with Google For Education, https://edu.google.com/products/productivity-tools/, to offer Custom Search Engine on your website for free without advertising.

AdSense script shouldn't load.

4. Problem 2 — Testing

I use clean-console for check, that browser console not contains errors. Output, if I test HTML above locally:

D:\SashaDebugging>clean-console -i output/KiraCleanConsole__cdn_links_demo.html
checking output/KiraCleanConsole__cdn_links_demo.html
phantomjs: opening page output/KiraCleanConsole__cdn_links_demo.html

phantomjs: Unable to load resource (#7URL:file://cse.google.com/adsense/search/async-ads.js)


phantomjs:   phantomjs://code/runner.js:30 in onResourceError
Error code: 203. Description: Error opening //cse.google.com/adsense/search/async-ads.js: The network path was not found.

phantomjs process exited with code 1

Judging by the output, possibly, Google Custom Search use protocol-relative URLs. See my detailed answer, why is it outdated already in 2014. I refer to Paul Irish — front-end engineer and a developer advocate for the Chrome.

In any case, this error makes it difficult to test. It needs to be fixed.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant