【问题标题】:Embedded piwik in rails在导轨中嵌入 piwik
【发布时间】:2016-01-31 15:52:12
【问题描述】:

我在我的本地系统中安装 piwik 并与 rails 应用程序 集成以跟踪当我使用 iframe 分析数据时出现问题通过 piwik,我想在我的 rails 应用 iframe 中显示 dashboard。但它显示错误

错误 糟糕……请求期间出现问题。可能服务器有一个临时问题,或者您请求的报告可能包含太多数据。请再试一次。如果此错误反复出现,请联系您的 Piwik 管理员寻求帮助。

我的配置文件config.ini.php

cors_domains[] = "*"
enable_framed_pages = 1
enable_framed_settings = 1

trusted_hosts[] = "192.168.1.101"
trusted_hosts[]= "localhost/analytics/piwik/"

在我的萤火虫错误中

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost/analytics/piwik/index.php?date=yesterday&module=Dashboard&action=embeddedIndex&idSite=1%252C2&period=day&idDashboard=1. (Reason: missing token 'x-requested-with' in CORS header 'Access-Control-Allow-Headers' from CORS preflight channel).

我的 erb.slim 文件

.panel.panel-primary
  .panel-heading
    h4 Piwik
    iframe height="200"sandbox="allow-scripts" width="600px;" src="http://localhost/analytics/piwik/"

【问题讨论】:

    标签: php ruby-on-rails iframe cors matomo


    【解决方案1】:

    如果我们需要piwikfull dashboard,那么我们只需通过管理员登录 cred,然后转到Widgets面板并复制<iframe> 代码并粘贴到您的应用程序中。

    示例: Piwik dashboard integration with iframe CORS

    您还通过&token_auth=xxxx 设置用户登录

    它将为您提供登录功能。只需将 token_auth 放在 url 末尾即可。

    在我的情况下,用户只有查看权限。

    http://localhost/analytics/piwik/index.php?module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&idSite=1&period=week&date=yesterday&token_auth=xxxxxxx
    

    【讨论】:

      猜你喜欢
      • 2014-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-30
      • 1970-01-01
      • 2011-08-04
      • 1970-01-01
      相关资源
      最近更新 更多