File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -89,10 +89,13 @@ function MainContainer(): any {
89
89
if ( ! user . debug ) {
90
90
//set current user cookie if it does not exist in cookies;
91
91
if ( user . checkDocumentCookie ( document ) ) {
92
- user . getCookie ( ) ;
92
+ console . log ( " USER " , user ) ;
93
93
mixpanel . people . increment ( user . get_dId ( ) , "times" ) ;
94
94
} else {
95
- user . setCookie ( ) ;
95
+ console . log ( "USER ESLE " , user ) ;
96
+ document . cookie = user . setCookie ( ) ;
97
+
98
+ console . log ( " USER AFTER COOKIE SET " , user ) ;
96
99
mixpanel . people . set ( user . get_dId ( ) , { times : 1 } ) ;
97
100
}
98
101
}
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ class MPID{
12
12
//create a string of random data
13
13
this . cookie = cookie . serialize ( "reactime" , crypto . randomBytes ( 64 ) . toString ( 'hex' ) ) ;
14
14
this . distinct_id = this . cookie ?. reactime ?. slice ( 0 , 20 ) ;
15
-
16
15
if ( this . cookie ) {
17
16
return this . cookie ;
18
17
} else {
@@ -22,7 +21,8 @@ class MPID{
22
21
}
23
22
24
23
getCookie ( ) {
25
- if ( this . cookie ) {
24
+ if ( this . cookie ) {
25
+ //this.distinct_id = parsedCookie?.reactime?.slice(0, 20);
26
26
return this . cookie ;
27
27
} else {
28
28
throw new Error ( "Cookie truthy, but unreturnable" ) ;
@@ -37,7 +37,8 @@ class MPID{
37
37
this . cookie = parsedCookie ?. reactime ;
38
38
if ( ! this . distinct_id ) {
39
39
this . distinct_id = parsedCookie ?. reactime ?. slice ( 0 , 20 ) ;
40
- }
40
+ }
41
+ return true ;
41
42
} else {
42
43
this . setCookie ( ) ;
43
44
return false ;
@@ -48,6 +49,9 @@ class MPID{
48
49
try {
49
50
if ( this . distinct_id ) {
50
51
return this . distinct_id ;
52
+ } else {
53
+
54
+ //return this.checkDocumentCookie
51
55
}
52
56
} catch ( e ) {
53
57
throw new Error ( `unable to set cookie. Reason: ${ e } . ` ) ;
You can’t perform that action at this time.
0 commit comments