0
votes

I'm using google analytics with the new api gtag. I want to send events that have specific dimensions rather than have common dimensions for each event that are configured in the beginning of the page load.

I'm trying do like this:

parameters.softwareOwner = HelperJSViewBag.getValue("softwareOwner");
parameters.softwareVersion = HelperJSViewBag.getValue("softwareVersion");
parameters.event_category = this.category.name;
parameters.event_label = this.description;
parameters.metricValue = 1;
parameters.customerID = cookieCustomer.id;
parameters.customerSessionID = cookieCustomer.id_session;
parameters.customerPartnerID = localStorageCustomer.partnerID;
parameters.customerName = localStorageCustomer.firstName + " " + 
localStorageCustomer.lastName;
gtag('event', parameters.metricName, parameters);

I'm using the tag assistance (by google) to track if the metrics are being sent to google analytics and it is being sent but only with the dimensions event_category and event_label.

enter image description here

What I'm doing is possible? If not there is any alternative to accomplish what I want?

1

1 Answers

1
votes

I discover what was my problem here. The google analytics does not recognize any dimension that I sent, at least with the name that I gave. What I need is to map each name with a costume name given by google. This name is composed with "dimension" + index (ex: dimension5; dimension6).

parameters.softwareOwner = HelperJSViewBag.getValue("softwareOwner");
parameters.softwareVersion = HelperJSViewBag.getValue("softwareVersion");
parameters.event_category = this.category.name;
parameters.metricName = this.name;
parameters.event_label = this.description;    
parameters.metricValue = 1;
parameters.customerID = cookieCustomer.id;
parameters.customerSessionID = cookieCustomer.id_session;
parameters.customerPartnerID = localStorageCustomer.partnerID;
parameters.custom_map = {
    "dimension1" : "softwareOwner",
    "dimension2" : "softwareVersion",
    "dimension3" : "customerID ",
     .........
}
gtag('event', parameters.metricName, parameters);