簡體   English   中英

我可以從Google自定義搜索API中獲取Google Ads進行請求的查詢嗎?

[英]Can I get Google Ads from Google Custom Search API for requested query?

我想使用Google自定義搜索API獲取特定搜索詞的Google Ads。 使用GET命令獲取搜索結果效果很好(請參見下面的代碼),但我認為響應中不包含廣告。

有沒有一種方法可以使用自定義搜索API從Google獲取針對特定搜索字詞的廣告? 還是可以使用另一個API?

我將非常感謝您的幫助,謝謝!

獲取搜索結果的代碼:

function requestSearchResult() {
    jQuery.get("https://www.googleapis.com/customsearch/v1/", {
            q: SearchTerm,
            cx: "01042***5fgs",
            key: "AL***Xra",
        },
        function(items, status) {
            document.getElementById("content").innerHTML += "<a href=\"" + items.items[0].link + "\">" + items.items[0].htmlTitle + "</a>";
            document.getElementById("content").innerHTML += "<br>" + items.items[0].displayLink;
            document.getElementById("content").innerHTML += "<br>" + items.items[0].htmlSnippet;
            document.getElementById('content').innerHTML += "<br>" + '<img src="' + items.items[0].pagemap.cse_thumbnail[0].src + '" alt="text mode" />';
            ...
            ...
        });

自定義搜索API不提供廣告。

如果您想要搜索和廣告,請考慮使用同時執行以下操作的自定義搜索元素: https : //developers.google.com/custom-search/docs/element

或注冊自定義搜索廣告: https : //developers.google.com/custom-search-ads/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM