: DataLayers, Wordpress and Analytics not showing any info I'm trying to use a JS function to retrieve data from categories, posts and etc, but I can't get any data. Here is the code I've been
I'm trying to use a JS function to retrieve data from categories, posts and etc, but I can't get any data.
Here is the code I've been trying to use:
gtm_datalayers = function() {
var dataLayer = window.dataLayer || [];
var dl_title = document.getElementsByTagName('title')[0].innerHTML;
var metaPub = document.querySelector("meta[property='article:published_time']");
if(metaPub){
var dl_date = document.querySelector("meta[property='article:published_time']").getAttribute("content");
} else {
var dl_date = document.getElementsByClassName('published')[0].innerHTML;
}
var dl_author = document.querySelector("meta[name='author']").getAttribute("content");
var dl_category = document.querySelector("meta[property='article:section']").getAttribute("content");
//var dl_dates = dl_date != '' ? dl_dateEntry : dl_date;
dataLayer.push({
'Date': dl_date,
'Author': dl_author,
'Post': dl_title,
'Categories': dl_category,
});
console.log(dl_date, 'n', dl_author, 'n', dl_category, 'n', dl_title);
}
I placed correctly my custom dimensions in GTM , Analytics, but it seems that something is missing.
UPDATE
Here my configuration of my Custom Report:
Here is my Custom Dimension Config
More posts by @Gretchen104
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.