Last active
December 28, 2023 17:50
-
-
Save ryanmorr/630e503f7e26e4aa67f31bd9f55ea325 to your computer and use it in GitHub Desktop.
Log an error with Google Analytics 4
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
function logError(error, fatal = false) { | |
const description = typeof error === 'string' ? error : error.message; | |
gtag('event', 'exception', { | |
description, | |
fatal | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment