Created
February 28, 2019 19:59
-
-
Save wp-seopress/f83c9174ed9c7af8d52bde4916247f0d to your computer and use it in GitHub Desktop.
Filter logged in users tracking custom dimension with Google Analytics
This file contains hidden or 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 sp_gtag_cd_logged_in_cf($html) { | |
| return "'dimension5': 'cd_logged_in',"; | |
| } | |
| add_filter('seopress_gtag_cd_logged_in_cf', 'sp_gtag_cd_logged_in_cf'); | |
| function sp_gtag_cd_logged_in_ev($html) { | |
| return "gtag('event', '".__('Connected users','wp-seopress')."', {'cd_logged_in': '".wp_get_current_user()->ID."'});"; | |
| } | |
| add_filter('seopress_gtag_cd_logged_in_ev', 'sp_gtag_cd_logged_in_ev'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment