Created
February 27, 2021 19:35
-
-
Save madilk/1dc2bb4423649a88fc0e77a2deafb7b1 to your computer and use it in GitHub Desktop.
Custom JS to extract age in Adobe Launch and Google Tag Manager From A Timestamp
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
//Custom JS to get age of user in Adobe Launch | |
var x=_satellite.getVar('dataLayer var: DOB'); | |
var dobYear = x.getFullYear(); | |
var curYear = new Date().getFullYear(); | |
var age = curYear - dobYear; | |
return age; |
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
//Custom JS to get age of user in Google Tag Manager. | |
var x={{dataLayer var: DOB}}; | |
var dobYear = x.getFullYear(); | |
var curYear = new Date().getFullYear(); | |
var age = curYear - dobYear; | |
return age; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment