Google Analytics screenname for events

拥有回忆 提交于 2019-12-12 16:08:35

问题


I'm confused about the "Screen Name" dimension in Google Analytics.

If you go to Behaviour -> Events -> Screens you'll see it.

I'm wondering how you can attach a screen name to an event. Currently I'm tracking screenview (hits) and event (hits). I thought analytics could get the screenname for an event by looking at the last screenview. But this doesn't seem to be the case.

Btw I'm using the Measurement Protocol.

Any ideas on this?


回答1:


I thought analytics could get the screenname for an event by looking at the last screenview. But this doesn't seem to be the case.

No, this is not the case. All data you send to Google Analytics is scoped to either a User, a Session, or a Hit (where every hit belongs to a session, and every session belongs to a user).

For user level data (e.g. client ID), Google Analytics is able to apply that data to all session and all hits for that users, but in the case of screen name and event data (e.g. event category and event action), these are all scoped to the hit level and therefore only apply to the hit they are sent with.

Most of the tracking libraries (including analytics.js and the Android and iOS SDKs) have the concept of a tracker, which is an object that can store data and send data to Google Analytics via the Measurement Protocol.

If you want to associate a particular screen name with all events that occurred when the user was on that particular screen, you'd need to send that screen name with all event hits as well. For convenience, the tracker objects allow you to set data on them, and then that data will get sent with all subsequent hits, so in your case you'd want to set the screen name on the tracker before sending any event hits.

Here's an example implementation using analytics.js:

ga('create', 'UA-XXXXX-Y', 'auto');

// Sets the `screenName` field to "Home Screen" for this
// and all subsequent hits.
ga('set', 'screenName', 'Home Screen');

// Sends a screenview hit for "Home Screen"
ga('send', 'screenview');

// Sends an event hit. Since the `screenName` field was
// already set on the tracker, that data will get sent
// with this hit as well.
ga('send', 'event', 'Navigation Links', 'click', '/about');

Note: all links are to analytics.js documentation pages, but the concepts apply to the Android and iOS SDKs as well.




回答2:


You can not attach screen name to an event. Instead all events that happen after you send screen view are attributed to the screen unless your session times out.

To achieve the same using the measurement protocol, send screenview measurement first followed by your event measurement. You might need to add all required params to both measurement for this to work.



来源:https://stackoverflow.com/questions/30414559/google-analytics-screenname-for-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!