duanliao6789 2012-12-06 08:49
浏览 49
已采纳

所有页面的首次使用者的网站导览

What is the best way to identify a user to visit a page in a site for the first time. I've written a script which shows a tour of the page. Since tours should be shown only once. I need to know.

For example consider a domain example.com if a user login for the first time i need to show a tour on the '/' page.. When the user navigates to '/page1' i should show the tour for that page. when the user go backs to '/' i shouldn't show the tour. But when user goes to '/page2' i should show the tour on page2.

I could able to find the first time when the user logs in by a single query.! but How can i do that for each and every page. My idea was to make a query to database every time when the user navigates but i know it's not the best way.

Note: Cookies can be used to track anything.

  • 写回答

2条回答 默认 最新

  • dsgdsf12312 2012-12-06 08:56
    关注

    When client logged in, check cookie for pages he has visited.

    If the cookie is empty, check database en create new cookie with the pages that de client allready had visited

    Further, on every page you check the cookie, if the page is not yet in it, show the tour and add it to the cookie (and the db), else do nothing :)

    Ofcourse the db part will only work with registered users. Also do not forgot to store the userid (or something similar) into the cookie and check that too, so that when another user browse your website on the same computer, he still will see the tour!

    Something completely else, but might be usefull in your situation is http://notes.xoxco.com/post/36766728425/aware-js-make-your-site-reader-aware

    This is a jQuery plugin that keeps track of you visits and change the layout accordingly (eg first time visitor, returning visitor but first time today, ...)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图