如何做类似谷歌分析的事情

发布于 2024-08-13 19:28:17 字数 583 浏览 1 评论 0原文

我需要制作类似 google-analytics 的东西,我的意思是它必须非常简单安装并且能够在两个网站之间进行通信。 让我解释一下这个想法。

我正在开发一个应用程序(与 ZF 合作),我的客户将是在线商店,仅在开始时为 OSCommerce。这些商店需要从我的应用程序的数据库中获取一些信息,向我发送一些信息并向他们的客户建议使用我的应用程序的服务。 代码需要做什么:

  • 如果 URL 中有某个 $_GET 参数(表明用户来自我的网站)->在商店中启动会话并向我发送一些统计信息(IP、浏览器信息等...)
    • 如果该用户在此会话期间购买了东西 ->向我发送一些有关销售的信息(总计、ID、...)
  • 以便用户(商店的客户,也是我的应用程序的成员)插入他的我的应用程序帐户中的电子邮件+密码,以便在他下的订单中获得折扣。

我知道如何对所有这些进行编程,编辑商店的文件,但我的问题是我不知道如何以谷歌分析方式进行制作(向我的客户提供一个小JavaScript以安装在他们的商店中),也不知道如何在谷歌中查找以找到我需要的信息。

那么,任何人都可以帮助我走上正确的道路吗? 提前致谢

I need to make something like google-analytics, I mean that it has to be very simple to install and enables a comunication between 2 websites.
Let me explain the idea.

I'm developping an application (with ZF) where my clients will be online shops, OSCommerce only at the begining. Those shops need to get some info from my app's database, send me some info and propose to their clients to use my app's service.
What does the code needs to do:

  • if there is a certain $_GET param in the URL (that indicates that the user is coming from my site) -> starts a session in the shop and send me some info for my stats (IP, browser info, etc...)
    • if this user buys something during this sesion -> send me some info about the sale (total, id, ...)
  • during the checkout process (checkout-payment.php in OSC) give the possibility to the user (the shop's client who is also a member of my application) to insert his email+password from his my-application's account in order to get a discount in the order he's placing.

I know how to program all this, editing the shop's files, but my problem is that I have no idea about how to make it in the google-analytics way (give a small javascript to my customers to install in their store) and neither what to look for in google in order to find the information I need.

So, can anyone helps me to get in the right path?
Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

傾旎 2024-08-20 19:28:17

由于您需要使用此实用程序进行跨域,因此您需要使用 JSONP.通过附加从 window.location 获取的信息(例如查询字符串),您可以简单地对您的服务器上的某些 PHP 脚本进行 JSONP“调用”。

Since you'll be needing to go cross-domain with this utility, you'll want to write your javascript piece for inclusion using JSONP. Your JSONP "call" could simply be made to some PHP script on your server by tacking on information obtained from window.location (like the query string, for example).

滥情哥ㄟ 2024-08-20 19:28:17

也许您所需要的只是给您的客户一个指向您的 js 库的 URL?您的图书馆可以工作或更好地为您的服务提供 API 以获取客户数据等吗?
是的 - JSONP 可以帮助您进行域间通信......

Maybe all you need is to give your customer an URL pointing to your js library? And than your library can work or better provide them with API to your service to get customer data etc.?
And yes - JSONP can help you with inter-domain comunication...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文