开发者

How do you setup google analytics no track the number of days a week that a unique visitor visits?

开发者 https://www.devze.com 2023-01-12 04:06 出处:网络
I am looking to be able to track how many a days a given unique visitor comes to the site.Ideally I am looking for a report that says:

I am looking to be able to track how many a days a given unique visitor comes to the site. Ideally I am looking for a report that says:

1 day a week: 562

2 days a week 380

3 days a week 42

etc...

Where if a unique visitor comes monday, wednesday and friday they would be added into the 3 days a week bucket regardless of how many times the开发者_如何学编程 given unique visitor visited the site during that day.

Is there any way to do this in Google Analytics? If not in GA is there off the shelf analytics tool/service that will do this easily?


I don't think you can do that out-of-the-box inside GA but what you can do is use a custom variable with a unique id for the user so that it can be listed as a dimension. Then you can see like

user visits

userA 3

userB 5

userC 2

userD 1 etc...

and then you can export to excel or somethin' and then do a count on grouped-by-visits rows.


Here is how I ended up solving this:

  1. Create a persistant cookie using javascript called weekly_activity
  2. In that cookie store the following information [#{sunday_date}, 0, 0, 0, 0, 0, 0, 0] - where each day of the week is represented by a zero
  3. When a visitor comes do the following things:
    a. Check if the cookie exists, if not create it all with zeroes
    b. If the cookie exists then check the date - if the date is not the last sunday then recreate the array with all zeroes
    c. If the date is fine then set the current day of the week position to 1
    d. If the sum of the array > 3 and the day array position was 0 but now is 1, then send a custom event to google analytics that says #{sunday_date}_#{visit_number}

This will allow us to compare # of people who visited 3 or more times all the way up to 7 or more times per week. You only have 50k unique custom events, but this should eat through them very slowly and allow you to do the broad tracking

0

精彩评论

暂无评论...
验证码 换一张
取 消