There is a sites that has user system with video watching function, I would like to check the following, notice that for those logined user view , need to include their user name at the track event:
a. if any viewer finish watch an entire video; and if so the number of videos viewed per visit / session?
b. if any viewer signed up ie the conversion rate?
Here is my guess:
a) track finish watching the video
add the track code at video complete event
ga('send', 'event', 'Videos', 'complete', '<?= $video_title; ?>' );
but for the whole session not sure will the above code have track that
b) video viewer that is sign up
add at the video detail page:
if logined:
ga('send', 'event', 'Videos', 'Play', '<?= $video_title; ?>' ,1);
if not logined
ga('send', 'event', 'Videos', 'Play', '<?= $video_title; ?>' ,0);
The problem is how to add the user name , and is the above track code can fulfill the requirement?
Thanks a lot for helping.
Google Analytics terms of use does not allow to track a users username, this is because it is classed as PII.
You can however track a user ID using a custom dimension providing that the ID is only able to be meaningfully interpreted by you.
You can add that on the pageview providing that the scope of the dimension is set to user.
ga('send', 'pageview', {'dimension1': 'XYZ123'});