【发布时间】:2018-03-10 12:15:18
【问题描述】:
最近我开始使用 yandex 的分析工具,它可以为您提供有关访问者的详细信息,即使它会记录每个访问者访问您网站的视频...该工具的链接是:metrica.yandex.com完全免费
无论如何,yandex 工具提供了一个名为地图的选项,它显示了访问者在您的网站上点击最多的地方,所以当我尝试使用它时
我收到一条错误消息说:
Not possible to replay visit on the given page. Possible reasons:
Counter code not configured
Displaying this page in a frame is forbidden
而且我很确定它的计数器代码配置良好,并且我已将其放在我网站上的正确位置,因此我访问了帮助页面链接:yandex.com/support/metrica/behavior/click-map。 html
看看有什么问题所以我发现了
If your site is protected from being shown in an iframe (the X-Frame-Options header is used in the server settings), the collected data won't be available for viewing. To view the site's session data, you must change the server settings and add an exception for the webvisor.com domain and subdomains, as well as for your site's domain. Use the regular expression
他们为使用 nginx 的用户提供了一个代码,需要将其添加到配置文件中以使地图正常工作
所以我添加了它,这是我添加几行后的配置文件
.....
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
set $frame_options '';
if ($http_referer !~ '^https?:\/\/([^\/]+\.)?(www.google\.com|webvisor\.com)\/'){
set $frame_options 'SAMEORIGIN';
}
add_header X-Frame-Options $frame_options;
}
.....
我已将我的域名更改为 www.google.com
但它仍然向我显示错误我不知道为什么但也许我错过了一些步骤......请大家建议我一个可能的解决方案我非常需要这个选项来知道我可以在哪里放置我的广告
【问题讨论】:
-
从
nginx -T的输出发布完整的nginx配置
标签: nginx x-frame-options yandex yandex-metrika