简体   繁体   中英

Google analytics core reporting api pageview label?

I'm trying to send some specific data to filter later on when using the GA core api. For instance when I track an event I can pass some parameters like so.

ga('send', 'event', {
    eventCategory: data.category,
    eventAction: data.action,
    eventLabel: data.label || null,
    eventValue: data.value || null,
    nonInteraction: data.interaction === false ? false : true
});

I can then filter these later on when making requests for the data. In particular I'm trying to track item id's which I store in the eventLabel fields. For events everything is good.

The part I'm having issues with is in filtering page views, sessions, etc. The call for that looks like:

ga('set', 'page', data.path);
ga('send', 'pageview', {eventLabel: 'test'});

The eventLabel in this case doesn't seem to work. I can't use filter by pagePath becasue I'm using pretty url's. I need to explicitly set the id in the page views if possible. Or some alternate method that works.

The pageview command doesn't take an eventLabel parameter, only a title , location , or page , as mentioned here https://developers.google.com/analytics/devguides/collection/analyticsjs/pages#pageview_fields . Perhaps try using a custom dimension for the item ID instead.

Also, might need to double check your nonInteraction logic for your event. If data.interaction is false, I would think this means it's not interactive, thus making nonInteraction true (and vice versa).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM