|
11 | 11 | } |
12 | 12 |
|
13 | 13 | const SAVED_GOOGLE_ANALYTICS_DESKTOP_KEY = "SAVED_GOOGLE_ANALYTICS_DESKTOP_KEY"; |
14 | | - const SAVED_CUSTOM_USER_ID_KEY = "SAVED_CUSTOM_USER_ID"; |
15 | 14 | let gaReady = false, loadedGoogleAnalyticsID; |
16 | | - let savedCustomUserID = localStorage.getItem(SAVED_CUSTOM_USER_ID_KEY); |
17 | 15 |
|
18 | 16 | const url = window.location.href; |
19 | 17 | const urlParams = new URLSearchParams(window.location.search); |
|
92 | 90 | document.head.appendChild(gaScript); |
93 | 91 |
|
94 | 92 | gtag('js', new Date()); |
95 | | - const configParams = {}; |
96 | | - if (savedCustomUserID) { |
97 | | - configParams.client_id = savedCustomUserID; |
98 | | - } |
99 | | - gtag('config', analyticsID, configParams); |
| 93 | + gtag('config', analyticsID); |
100 | 94 | gaReady = true; |
101 | 95 | } |
102 | 96 |
|
|
115 | 109 |
|
116 | 110 | async function processRequest(event) { |
117 | 111 | const payload = event.payload; |
118 | | - if (payload.customUserID && payload.customUserID !== savedCustomUserID) { |
119 | | - savedCustomUserID = payload.customUserID; |
120 | | - localStorage.setItem(SAVED_CUSTOM_USER_ID_KEY, payload.customUserID); |
121 | | - if (gaReady) { |
122 | | - gtag('config', loadedGoogleAnalyticsID, { |
123 | | - client_id: savedCustomUserID, |
124 | | - send_page_view: false |
125 | | - }); |
126 | | - } |
127 | | - } |
128 | 112 | if(payload.analyticsID && loadedGoogleAnalyticsID !== payload.analyticsID) { |
129 | 113 | localStorage.setItem(SAVED_GOOGLE_ANALYTICS_DESKTOP_KEY, payload.analyticsID); |
130 | 114 | installGoogleAnalytics(); |
|
0 commit comments