14
readers helped!

This helped me

How to Make a Tracking Cookie

Tracking cookies enable the owner of a Web site to obtain information from visitors to his or her site. The Web site's owner can use the information to learn more about visitors and/or provide visitors with a more personalized and streamlined experience. For example, a cookie can store a Web site visitor's user name and password so the visitor does not have to populate this information every time he or she visits the Web site, saving the visitor time.

Steps

  1. How.com.vn English: Step 1 Plan on what information you want your cookie to collect.
    Before you make a tracking cookie, you should determine what type of information you want to track from visitor's to your Web site. For instance, you may find it important to know the zip code of a person visiting your Web site if your Web site sells products that require shipping costs and certain sales taxes.
  2. How.com.vn English: Step 2 Use HTML.
    If you have created your Web site using HTML code and are somewhat familiar with programming, you can make a tracking cookie from scratch.
    • Use the “Response” command to write a cookie on a visitor's computer. “Response.Cookies(“CookieName”)=value” is the most basic form of this code. The code: “Response.Cookies("VisitorName")=Request.Form("UserName")” would allow you to keep track of a visitor's user name.
    • Use the “Request” command to retrieve the cookie. “Request.Cookies("CookieName")” would allow you to retrieve the information from the visitor's computer when the visitor returned to your Web site.
  3. How.com.vn English: Step 3 Note however that standard HTML does not have commands.
    "Response" and "Request" are part of Microsoft's ASP (active server pages). See http://www.w3schools.com/asp/coll_cookies_response.asp If your web server does not support ASP, you'll have to investigate other methods of generating cookies, such as CGI scripts or PHP.
  4. How.com.vn English: Step 4 Consider tracking cookie software as an alternative to writing your own code.
    There are software programs out there that will do the heavy coding for you.
    • Software will allow you to make certain kinds of cookies; sometimes a single type of software will only allow you to make a specific cookie. Some of this software is considered “freeware,” and thus won't cost you anything. Tracking cookie software can help with restricting how many times a visitor can download software from your Web site by remembering that the software was already downloaded.
  5. How.com.vn English: Step 5 Add security to your cookie.
    Internet security is a key concern of most Internet users. It’s important to provide security so that visitors' information is protected.
    • A domain property will restrict the cookie from being read by another Web site. A sample of the code for this is: Response.Cookies("CookieName").Domain = "www.mydomain.com"
    • A path property restricts the cookie to being read by a specific path. A sample of the code for this is: Response.Cookies("CookieName").Path = "/maindir/subdir/path"
  6. How.com.vn English: Step 6 Give your cookie an expiration.
    A cookie will expire once the Web browser the visitor uses to view your Web site is closed. An expiration date must be set if you want to store the cookie so that when the user comes back the information is saved. An example of this code is: Response.Cookies("CookieName").Expires=#January 01, 2010# (assuming a January 01, 2010 expiration date).
    Advertisement

Community Q&A

Search
Add New Question
  • Question
    Can someone track if I just look at a picture they posted?
    How.com.vn English: Community Answer
    Community Answer
    The web-server can if it has implemented a method to do so, such as cookie tracking. It depends on the site.
  • Question
    Do I have a unique code on my mobile phone?
    How.com.vn English: Community Answer
    Community Answer
    If you mean the advertising ID, then yes, your phone has one (although this is usually for apps). You can reset this in settings.
  • Question
    What does a cookie look like?
    How.com.vn English: Living Concrete
    Living Concrete
    Top Answerer
    A cookie is typically invisible to a user. You have to use special tools to view it. If you use something like Chrome Dev Tools or Firebug to view a cookie, you'll see that it is actually just a key-value pair.
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit

      Advertisement

      Tips

      • Always give your cookies unique names so that you can keep them organized.
      Advertisement

      About this article

      How.com.vn is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 12 people, some anonymous, worked to edit and improve it over time. This article has been viewed 121,782 times.
      How helpful is this?
      Co-authors: 12
      Updated: May 6, 2021
      Views: 121,782
      Thanks to all authors for creating a page that has been read 121,782 times.

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement