将谷歌分析添加到PHP仪表板

时间:2022-05-26 15:14:56

Hi I have a website that I am creating at the moment I have just created a dashboard for admin users I was wondering is there a way I can embed a Google analytic's dashboard or the elements of the dashboard into my own website.

嗨我有一个我正在创建的网站,我刚刚为管理员用户创建了一个仪表板我想知道有没有办法可以将Google分析仪表板或仪表板的元素嵌入到我自己的网站中。

  • My initial thought would be an i frame of the web page and then getting the user to sign in
  • 我最初的想法是网页的i框架,然后让用户登录

  • I have looked at different questions surrounding this and people are being told to look at the Developer Guides and the implementing the API into their site, Can I do this ??
  • 我已经查看了围绕此问题的不同问题,人们被告知要查看开发人员指南并在其网站中实施API,我可以这样做吗?

My website is PHP based with some HTML I am not sure if I am using a framework that the analytics can be implemented into because at the moment I'm currently using bootstrap for the admin dashboard the rest I have hand coded.

我的网站是基于PHP的一些HTML我不确定我是否使用可以实现分析的框架,因为目前我正在使用管理仪表板的引导程序,其余的我手工编码。

Any guides any examples of people doing this themselves that would be much appreciated.

任何指导任何人自己做这个的例子将非常感激。

1 个解决方案

#1


1  

I would recommend you look into using the Google Analtyics API with a service account. You will only be logging into your own data so there is no need to go though the full Oauth2.

我建议您考虑将Google Analtyics API与服务帐户配合使用。您将只登录自己的数据,因此无需通过完整的Oauth2。

The most current version of the Google PHP client lib can be found here on github under examples you want to look into the service-account.php it should show you how to get working with a service account.

最新版本的Google PHP客户端库可以在github上找到您要查看service-account.php的示例,它应该向您展示如何使用服务帐户。

Note: Unfortunately the hello analytics tutorial is out of date and uses the old client lib, don't go there. I have been told they are working on an update for it.

注意:不幸的是,hello analytics教程已过时并使用旧的客户端库,不要去那里。我被告知他们正在为它做更新。

#1


1  

I would recommend you look into using the Google Analtyics API with a service account. You will only be logging into your own data so there is no need to go though the full Oauth2.

我建议您考虑将Google Analtyics API与服务帐户配合使用。您将只登录自己的数据,因此无需通过完整的Oauth2。

The most current version of the Google PHP client lib can be found here on github under examples you want to look into the service-account.php it should show you how to get working with a service account.

最新版本的Google PHP客户端库可以在github上找到您要查看service-account.php的示例,它应该向您展示如何使用服务帐户。

Note: Unfortunately the hello analytics tutorial is out of date and uses the old client lib, don't go there. I have been told they are working on an update for it.

注意:不幸的是,hello analytics教程已过时并使用旧的客户端库,不要去那里。我被告知他们正在为它做更新。