Previously I wrote "analytics's visitor category tracking". Recently, I want to change the visitor level by changing the session-level custom variables. I originally wanted to set the session-level user variables through user interaction, then, we can determine whether the visitor-level user variables are changed based on the changes in the session-level user variables to form a set of member data mechanisms, but the actual operations are
Previously I wrote Google Analytics's visitor category tracking, recently, I want to change the visitor level by changing the session-level custom variables. I originally wanted to set the session-level user variables through user interaction, and then change the user variables based on the session-level user variables, to determine whether the visitor-level user variables have changed, so as to form a set of member data mechanisms, but the actual operation is
Previously, I wrote "Google Analytics visitor category tracking". Recently, I want to change the visitor level by changing session-level custom variables.
Originally, we wanted to set session-level user variables through user interaction, and then determine whether the visitor-level user variables have changed based on the changes in session-level user variables to form a set of member data mechanism.
But the actual operation is not that simple. After setting visitor-level user variables, I can simply get the value. The specific method can be to read the utmz of cookies, or use the _ getVisitorCustomVar function.
However, session-level user variables cannot be obtained because session-level and Webpage-level variables are not stored in cookies, but are transmitted back to Google Analytics.
Although the _ getVisitorCustomVar function is used to obtain user variables, I can only obtain visitor-level variables in actual tests.
I define a function in the header and want to change the user variable according to the number of pages, visits, user behaviors, etc. However, a majority of the user variables have been deleted due to the failure, and the rest is just like this.
<? Php if (isset ($ _ COOKIE ['_ utm']) {$ visitutma =$ _ COOKIE [' _ utm']; $ lastlen = strrpos ($ visitutma, ". "); $ visitcount = substr ($ visitutma, $ lastlen + 1);} if (isset ($ _ COOKIE ['_ utmb']) & isset ($ _ COOKIE ['_ utmc']) {$ visitutmb =$ _ COOKIE ['_ utmb']; $ visitutmc =$ _ COOKIE ['_ utmc']; $ utmclen = strlen ($ visitutmc); $ countlen = strpos ($ visitutmb ,". ", $ utmclen + 1)-$ utmclen-1; $ visitpagecount = substr ($ vis Itutmb, $ utmclen + 1, $ countlen);} if (isset ($ _ COOKIE ['_ utmv']) {$ visitutmv =$ _ COOKIE ['_ utmv'];} if ($ visitpagecount <= 1) {?>