-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: send extra data while submitting interview form
- Loading branch information
1 parent
7254f57
commit a056130
Showing
6 changed files
with
109 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* 從 GA SDK 取得 User Pseudo ID,又稱 Client ID | ||
* 是使用者在該 GA 資源、該 device 上的 user id | ||
* Ref: | ||
* 1. https://support.google.com/analytics/answer/12675187?hl=en | ||
* 2. https://developers.google.com/tag-platform/gtagjs/reference#get | ||
* @param {*} ga_measurement_id | ||
* @returns | ||
*/ | ||
export const getUserPseudoId = async ga_measurement_id => { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
if (typeof window !== 'undefined' && typeof window.gtag !== 'undefined') { | ||
window.gtag('get', ga_measurement_id, 'client_id', field => | ||
resolve(field), | ||
); | ||
} else { | ||
resolve(null); | ||
} | ||
} catch (e) { | ||
console.error(e); | ||
reject(null); | ||
} | ||
}); | ||
}; |