嵌入 API 使用自定义组件无法显示

Embed API Working with Custom Components fails to display

Google Analytics 演示代码位于 .

以分析帐户的所有者身份登录 Google Chrome,然后导航到该页面正确显示我的 Google 分析数据。

我按照页面上的说明将代码嵌入到一个简单的页面中。

身份验证按照显示的消息指示进行:“您登录为:me(at)gmail.com”但仅此而已,没有图表没有消息。

我有理由确定页面编码正确,正如我所做的那样:

所有工作和显示都正确(它们显示但样式不像演示)。

为什么页面不显示图形?

正如 Eike 在评论中指出的那样,您只是简单地复制并粘贴了演示中的代码,而没有将组件下载到您自己的服务器上。如果你打开你的 JavaScript 控制台,你会注意到你有 404 错误提示浏览器找不到这些组件。这是我在您网站上看到的屏幕截图:

要将这些组件添加到您的站点,您有多种选择。我已经回答了一个关于回购 Github 问题的 similar question,但为了方便起见,我会把它复制到这里。

The built and minified versions of those components are located in the build/javascript/embed-api/components directory. You can simply download those files and add them as script tags on your page, or include them in your site's main, bundled script.

If you're using an AMD script loader like RequireJS, you can also just point to those built files as they're wrapped in a UMD wrapper.

If you're using a tool like browserify or webpack, you can npm install this repo and require the files in the src/javascript/embed-api/components directory.