0
votes

Hello I am trying to attach custom dimension while sending events to Google Analytics using NodeJS.

I am using universal analytics npm package.

When I am sending only one custom dimension it is working fine, but the problem is while setting more than one custom dimensions only the first custom dimension is getting tracked.

    visitor.set("cd1", <value>);
    visitor.set("cd2", <value>);
    visitor.event(params).send();

Only value of cd1 is reflecting. Any solution?

1
Thats not an official npm package created by google i would contact the developer see if they even support multiple custom dimensions. github.com/peaksandpies/universal-analytics - DaImTo
thanks, solved the issue bdw. - Ranjan

1 Answers

0
votes

Finally found the required format. We need to send in this format:

params = {
    ec: eventCategoryValue,
    ea: eventActionValue,
    el: eventLabelValue,
    cd1: valueOfCustomDimensionAtIndex1,
    cd2: valueOfCustomDimensionAtIndex2
}

It will reflect in GA.