开发者

Use Cookies for "entering" referral tracking utilizing document.referrer?

If one comes to my site from say nextag.com, goes through a couple pages and gets to my Thank You page after ordering, is there a way to (for all intense and purposes) put an alert on the Thank You page saying "Thanks for coming from nextag". I can utilize this answer to do other code on the Thank You page.

I know I use document.referrer to grab all incoming referrals, however if one goes through a few pages on the site it looses its "entering" referral, I need to grab the "entering" referr开发者_JAVA技巧al and use it on the Thank You page. Do I somehow use cookies to do this?


  • It is possible to do with cookies (from Javascript). You can read about cookie management with Javascript in great detail for example here: Cookies with Javascript on QuirksMode

  • Using jQuery, there are plugins out there for cookie management like jquery-cookie.

  • Another option would be to manage this on the server side (sessions for example), because the referrer will be available in the HTTP header of the request, but you haven't specified which language you use there, so it might not be an option for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜