setVisitorIdCookie

The setVisitorIdCookie() method sets a visitor cookie in a browser (_pk_id.*). This cookie contains the visitor ID.

Syntax

setVisitorIdCookie()
setVisitorIdCookie(): void
setVisitorIdCookie(): void
setVisitorIdCookie(): void
setVisitorIdCookie(): void
setVisitorIdCookie(): void
setVisitorIdCookie(): void

Examples

To set a visitor cookie:

_paq.push(["setVisitorIdCookie"]);
setVisitorIdCookie(): void
setVisitorIdCookie(): void
setVisitorIdCookie(): void
setVisitorIdCookie(): void
setVisitorIdCookie(): void
setVisitorIdCookie(): void

Notes

  • Use this method only if you have installed the Piwik PRO container (or tracking code) in a non-standard way and the script needs to know the visitor ID before sending the first tracking request. Make sure it's called after all necessary cookie configuration methods are called (setCookieNamePrefix(), setCookieDomain(), setCookiePath(), and the like).

Related methods