Reputation: 734
My company was using GTM to track events, but we have switched to using gtag.js recently. Most of the conversion has gone well but I have one particular event I can't seem to convert correctly. It is for a service called Namogoo. We just track when their system fires an event so we can have a report in the GA portal.
The original GTM code is:
const someValue = 1
dataLayer.push({
event: 'gtm.trackEvent',
nB: someValue,
trackEvent: {
'category':'Namogoo',
'action':'block',
'label':'block',
'value':someValue
}
});
I have attempted a variety of things but my latest iteration which SHOWS the event in the realtime events interface but does not show on the custom report is:
gtag("event", "Namogoo", {
"event_category":"Namogoo",
"event_action":"block",
"event_label":"block",
"event_value": someValue,
"value":someValue
});
I'm basically just throwing spaghetti at the wall with the 'value' field. Any help would be appreciated. The custom report just operates on a Drilldown dimension created on the Namogoo event.
Upvotes: 0
Views: 1005
Reputation: 734
Thank you XTOTHEL for your help.
The root of the issue turned out to be a missing custom_map in my gtag configuration to cover the custom dimension.
gtag("event", "Namogoo", {
"event_category":"Namogoo",
"event_action":"block",
"event_label":"block",
"nB":nB
});
Upvotes: 0
Reputation: 5198
So your datalayer push implementation, this is how I understand it:
const someValue = 1
dataLayer.push({
event: 'gtm.trackEvent',
nB: someValue, //this is the same value as trackEvent.value
trackEvent: {
'category':'Namogoo', //maps to event category
'action':'block', //maps event action
'label':'block', //maps event label
'value':someValue //same value as 'nB'
}
});
For event tracking in gtag.js, this is the format:
gtag('event', <action>, {
'event_category': <category>,
'event_label': <label>,
'value': <value>
});
So putting everything together this should be what you're after:
const someValue = 1
gtag('event', 'block', {
'event_category': 'Namogoo',
'event_label': 'block',
'value': someValue
});
Note, you have the label the same as the action, not too sure what purpose it serves.
Upvotes: 1