I'm using google analytics to track page views on my site. trying to send custom dimensions during my pageviews. Here is what I have for the JS code
ga("create", '<UA-tracking ID goes here-01>', {
'name': 'TrackingID3'
});
// SendPageView
ga(function () {
var trackers = ga.getAll();
trackers.forEach(function (tracker) {
ga('set', 'dimension1', '187989840'); // departmentId
ga('set', 'dimension2', 'BLUE JEANS'); // caseName
tracker.send("pageview");
});
});
The code above works but it does not send the custom dimensions
I made a new web project and a new google analytics account (new email). Everything is set up and working in the new google analytics account. Here is the code i have for the second web project
ga('create', 'UA-tracking ID goes here-01', {
'cookieDomain': 'none'
});
// SendPageView
ga(function () {
var trackers = ga.getAll();
trackers.forEach(function (tracker) {
var dimensionValue = '187989840'; // departmentId
ga('set', 'dimension1', dimensionValue);
var dimensionValue = 'BLUE JEANS'; // caseName
ga('set', 'dimension2', dimensionValue);
tracker.send("pageview");
});
});
I tested the new web project and it successfully send the custom dimensions
Any Idea what I'm doing wrong?