Comment
Keiichi Takeda
Mega Explorer
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
02-25-2022
03:34 AM
Hi,
Based on the information so far, I customized the tags.
angular.module('spgtag', []).run(function($rootScope, $window, $location){
$rootScope.$on('$locationChangeSuccess', function(event, toState, toParams){
setTimeout(function() {
$window.dataLayer = $window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '|tracking-id|', {
'page_path': $location.url(),
'page_location': $location.absUrl(),
'page_title': $window.document.title
});
}, 1000);
});
});
- Customized to get the page title, location URL, path.
gtag('config', '|tracking-id|', {
'page_path': $location.url(),
'page_location': $location.absUrl(),
'page_title': $window.document.title
});
- The waiting time for acquiring the page transition destination information is set.
setTimeout(function() {...}, 1000);
※Adjust the length of time according to the environment.
I hope this helps.
Thanks.