我看到一个网站在页面上嵌入了一个交互式谷歌趋势图:http: //knowyourmeme.com/memes/danbo
当我检查元素时,图表嵌入了代码:
<script type="text/javascript" src="http://www.google.com/trends/embed.js?hl=en-US&q=danbo%20robot,danbo%20amazon,danbo%20yotsuba&content=1&cid=TIMESERIES_GRAPH_0&export=5&w=600&h=350"></script>
我检查了 html 顶部的 google 相关脚本,我发现了这些:
<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-15176568-9'); ga('send', 'pageview'); </script>
<script type="text/javascript"> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; gads.src = 'http://www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); googletag.cmd.push(function() { googletag.pubads().setTargeting('site', 'kym'); googletag.pubads().setTargeting('page', '_memes_danbo'); }); </script>
但是当我这样创建一个html文件时:
<html>
<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-15176568-9'); ga('send', 'pageview'); </script>
<script type="text/javascript"> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; gads.src = 'http://www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); googletag.cmd.push(function() { googletag.pubads().setTargeting('site', 'kym'); googletag.pubads().setTargeting('page', '_memes_danbo'); }); </script>
<script type="text/javascript" src="http://www.google.com/trends/embed.js?hl=en-US&q=danbo%20robot,danbo%20amazon,danbo%20yotsuba&content=1&cid=TIMESERIES_GRAPH_0&export=5&w=600&h=350"></script>
</html>
我没有谷歌趋势图但我没有得到图表并且有这个:
当您访问 Google 趋势网站时,例如http://www.google.com/trends/explore?hl=en-US#q=danbo+robot,danbo+amazon,danbo+yotsuba,有一个嵌入脚本可以复制并粘贴到 html 中,但是当我把它放在我自己的 html 中时,它也不起作用。
我如何嵌入一个交互式谷歌趋势图,就像这个网页 http://knowyourmeme.com/memes/danbo的末尾一样?