My Custom Dimensions & Metrics don't show in Google Analytics?

你。 提交于 2020-01-04 05:34:29

问题


I am using Google Tag Manager with Google Analytics (Universal Analytics).

Here is my setup, and here is our Donation Page.

The dataLayer is created before the Google Tags as:

var dataLayer = [{
'pageCategory' : 'Donation Page',
'txnPhase' : 'Transaction Pageview',
'txnT1' : new Date()
}];

On our eCommerce page I have added this code with executes only when a transaction is committed (and it works).

//TEMP BATCH
var gaqTemp = [].concat.apply([], gaq); //Puts 3 arrays of eCome data together so I can access it easier

//DIMENSIONS
var giftID = gaqTemp[1];
var txnID = gaqTemp[11];
var txnPhase = 'Transaction Closed';

//METRICS
var giftAmount = gaqTemp[3];
var giftCount = gaqTemp[15];
var txnT2 = new Date();

//PUSH TO dataLayer
dataLayer.push({'giftID' : giftID, 'txnID' : txnID, 'txnPhase' : txnPhase, 'giftAmount' : giftAmount, 'giftCount' : giftCount, 'txnT2' : txnT2});

The result looks like this when a donation is pushed and successful:

Here is what my Google Tag Manager (GTM) Setup looks like to track the data:

And this is the Trigger: ClicksDonate_Class,

And lastly, here is are my setups for Custom Metrics and Dimensions in Google Analytics (GA):

Any of my reports with these Custom Metrics show no results (tested over several days).

I am looking for any suggestions.

Thank you, RCS

PS. Here is my previous post where I 'thought' I solved my issue... http://bit.ly/1OOhOH6

Here is another post with a similar issue.


回答1:


Pressing the 'Donate Button' executes the following, in order: *(0) 1. Data from form pushed into eCommerce array: '_gaq'; 2. Data in eCommerce array sent to neverland (doesn't matter where); 3. 'gaqTemp' array created to concat the three '_gaq' arrays; 4. dataLayer.push() populates dataLayer with objects out of select variables from 'gaqTemp'; 5. Done.

*Somewhere between step (0) and step (1), whent he button is pressed, the GTM trigger fires (on click of button with class etc...) and the tag fires.

Everything I want to happen is happening, just not in the right order. The dataLayer is being populated at the time of 'clicks donate button', as such:

dataLayer.push({'giftAmount' : ''}); //everything is null at this point

rather than,

dataLayer.push({'giftAmount' : Some Amount});

because the variables are empty when the tag fires.

My dataLayer shows all the expected objects and values in the log, because they are pushed.

This makes my real issue, finding a way to populate the dataLayer before firing the tag to collect the dataLayer data.



来源:https://stackoverflow.com/questions/34121226/my-custom-dimensions-metrics-dont-show-in-google-analytics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!