简体   繁体   English

我应该使用什么来从其他网站获取统计信息?

[英]What should I use to get stats from other websites?

I don't know my question title is correct or not but let me explain you what I want to do.我不知道我的问题标题是否正确,但让我向您解释我想做什么。

So I want to generate a script from my dashboard website(eg dashboard.com) which user will put on his website's page( http://userwebsite.com/thankyou.php ) and when any user visit that page I want to store the number of visits of that page on my dashboard website( http://dashboard.com ).所以我想从我的仪表板网站(例如dashboard.com)生成一个脚本,用户将把它放在他的网站页面( http://userwebsite.com/thankyou.php )上,当任何用户访问该页面时,我想存储该页面在我的仪表板网站( http://dashboard.com )上的访问次数。

Currently I am using XMLHttpRequest .目前我正在使用XMLHttpRequest So I generate a script which has the code of Ajax and that ajax hits a post request on my dashboard website(I am using some token for a particular script).因此,我生成了一个包含 Ajax 代码的脚本,并且该 ajax 在我的仪表板网站上点击了一个发布请求(我正在为特定脚本使用一些令牌)。

I am not sure this is the right way or not to achieve my goal.I am sure you guys have seen these kind of scripts.我不确定这是不是实现我的目标的正确方法。我相信你们已经看过这些脚本。 There are so many websites (most popular Google Analytics).有很多网站(最受欢迎的谷歌分析)。

Please help me what should I do for it, or it's fine to use ajax?请帮我该怎么办,还是用ajax就好了?

Thanks.谢谢。

JavaScript is a common choice for that type of thing, so you're on the right track with Ajax. JavaScript 是这类事情的常见选择,因此您在使用 Ajax 时走在正确的轨道上。 One of the advantages to the JavaScript approach is that it's simple for other users to add it on a site. JavaScript 方法的优点之一是其他用户可以轻松地将其添加到站点上。

With your script, you can add options for naming the page, or recording certain actions, etc. You may have an issue if a user has disabled JavaScript, but that tends to be a small number of users these days.使用您的脚本,您可以添加用于命名页面或记录某些操作等的选项。如果用户禁用了 JavaScript,您可能会遇到问题,但现在这往往是少数用户。

I will say that I see GET requests used more often for that type of thing.我会说我看到 GET 请求更常用于这种类型的事情。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我应该如何使用PHP $ _GET和变量用其他文件中的内容填充模板页面? - How should I use PHP $_GET and variables to fill my template page with content from other files? 如何确定应该使用哪种套接字从RabbitMQ队列中获取消息? - How can I determine what sort of socket I should use to get messages from a RabbitMQ queue? 我应该使用哪种Jquery mouseevent来获取正确的值? - What Jquery mouseevent should I use to get the correct value? 我应该使用什么而不是 document.domain 来获取域? - What should I use instead of document.domain to get the domain? 我应该使用什么活动? - What event should I use? 我应该使用什么生命周期方法来监听 state 的变化并在反应 class 组件中相应地更新其他 state - What lifecycle method should i use to listen for changes in state and update other state accordingly in react class component 我应该使用什么协议以及它的文档是什么? - What protocol should I use and what are the docs for it? 如何将我的 chrome 扩展程序用于其他网站 - how to use my chrome extension to other websites 我有2个网站(在不同的域上)需要彼此“交谈”。 JSONP旁边有哪些解决方案? - I have 2 websites (on different domains) that need to “talk” to each other. What solutions are there beside JSONP? chrome扩展程序是否可以访问Tabs内容(其他网站) - Should chrome extensions have access to Tabs content (other websites)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM