dongyong8071 2015-10-31 07:38
浏览 43

嵌入式piwik在rails中

I am install piwik in my local system and integrate with rails application for tracking there is problem when i am using iframe for Analytic data by piwik i want to show dashboard inside my rails app iframe. But it's showing errors

Error Oops… there was a problem during the request. Maybe the server had a temporary issue, or maybe you requested a report with too much data. Please try again. If this error occurs repeatedly please contact your Piwik administrator for assistance.

My config file config.ini.php

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

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

In my firebug Error

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).

My erb.slim file is

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

1条回答 默认 最新

  • duanaidang6197 2015-10-31 10:02
    关注

    If we need full dashboard of piwik then we simply login via admin cred , and go to the Widgets panel and copy that <iframe> code and paste is to your application.

    Example: Piwik dashboard integration with iframe CORS

    Your also set user login by its &token_auth=xxxx

    It will provide you login functionality. Just put the token_auth after end of url.

    In my case user with only view permission.

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

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看