Am trying to create a view of top 5 most viewed users in the site. The statistics filter and sort are not available in my user view.

Does ga-stats only work with nodes or am i missing something??? Thanks

Comments

vagelis-prokopiou’s picture

I have the same issue with 7.x-1.0-beta2. I just can't set up a view that shows anything. Can you provide a guide for setting up a view? Maybe we do something wrong? Thank you very much.

Anonymous’s picture

@drz4007 use the dev version and once you authenticate your analytics account you'll get the statistics filters in the view you create.

vagelis-prokopiou’s picture

Dhamub, I installed the dev version, but still, after 24 hours, no stats are showing. I have authenticated and everything. I tried both page views in the last 31 days and now, page views in the last hours, but the result (if I don't add any filter criteria) is 0, and when I add criteria (page views are zero or more), no articles are showing... Isn't that strange? I suppose they should show even if they had 0 views, according to the filter criteria.

PS. If I try to update the counts, I get the following message: "Failed to retrieve data from Google Analytics"... The account is authenticated, up and running. Do you have any idea what might be the problem?

Thanx.

Anonymous’s picture

Have you installed the google analytics module or put in the analytics tracking code manually.

vagelis-prokopiou’s picture

I have installed the ga module. I didn't add anything by hand. I also added (as an experiment) the ga reports, and it worked ok with my ga account. I uninstalled it though because it requires the statistics core module... But, the point is that it worked with my ga account. On the other hand, I can't get the ga statistics to work...
At the status page I get this message:

GA Stats API Version Compatibility v2.4
Google Analytics data has not been accessed yet. Please run cron or visit the configuration page to update counts.

As I told you before, when I try to manually update the counts, it fails.

Anonymous’s picture

Am not sure what is happening. Which version of the ga module have u installed. if u r using 7.x-2 try installing 7.x-1.4 and check.

vagelis-prokopiou’s picture

I installed the 7.x-1.4 version. The error at the status page seems to have gone away. I tried to manually update the counts and I got this back:

Failed to retrieve data from Google Analytics.
Counts Successfully Updated.

Isn't that strange?
So far I see no impact on the view I have created. I will leave it a day or two to see if the page views start showing in the view I have created and I will get back to you. For now, thanx a lot for the help.
If it doesn't work, I really can't think of anything else...

PS: I have installed the boost module. Do you think that caching may have something to do with this? I think not. The view I created has its own page and is not cached at all. Plus, only me the admin has access to it for now, so it is not cached by the boost module either.

Anonymous’s picture

@drz4007 if the module works with 7.x-1.4 and not 7.x-2 of ga do open a separate issue requesting a module or documentation update.

vagelis-prokopiou’s picture

Unfortunately, it still cannot retrieve data from google analytics... Not even with the 7.x-1.4 version of the module... I really am at a loss here. I can't think of anything else. Anyway, thanx a lot for the help my friend.

Anonymous’s picture

Hey am using the 7.x-1.4 version and ga stats to create my view. It works good and i should add it took some time for me to get them to work. The modules work, it should just be a minor config issue. Keep trying.

vagelis-prokopiou’s picture

Thanks for the encouragement, but I don't think I can find what is wrong. All the setup seems right. The only thing I can think of is that I have 2 factor authentication at google and I use an app password for the Drupal module. But even when I disabled 2 factor authentication to check if that is the problem, I got exactly the same behavior...
I will just wait to see if something shows up at my view.
Thanx man.

david_garcia’s picture

This module is designed to work only with nodes, not other entities such as users. Such a change will require a complete refactor of the module.

vagelis-prokopiou’s picture

Dhamub was talking about users, but I was talking about nodes. I missed the fact that he was talking about users, so I mistakenly commented on this issue. The problem I am having is exactly this: No values loading.
I continued commenting on that issue.

cuteapoot’s picture

Title: stats not present in user view » Add support for statistics for User views
Category: Support request » Feature request

I'm going to jump in and just turn this into a feature request. I think there's a decent use case for stats based on users, e.g. tracking a specific user's progress through the site, how much time they're spending on the site, etc.

Fortunately for you, I'm in a position where I might be able to help with any refactoring that might need to happen, so if you agree that it's worth the effort to add this functionality, I would be happy to do a decent amount of the work involved in refactoring and updating the module to work for users. I'm good friends with Kazanir, one of the Commerce Guys, who lives for Views handlers, so I'm sure I could get his help if I get stuck.

Alternatively, if you think this isn't the right thing for your module right now, let me know and I'll just make a separate module for what I need and maybe we can merge them in the future.

david_garcia’s picture

Database storage needs needs to be refactored, I think it would be better to make a new branch for this.

Current storage looks like this (ga_stats_count):

nid
url
metric
timeframe
count

But for a more generic approach nid + url should be replaced by:

id
entity
bundle
url

The problem here is how to reverse the data obtained from analytics, you have the URL and need to get the id + entity + bundle.

For nodes, this is done in method ga_stats_nid_from_url()

But to make this generic, I think we would need to preload path structure for all entities/bundles provided by entity_uri() and for each url see if it matches any of them.

Just a comment: this will not serve to the purpose you are describing "tracking a specific user's progress through the site, how much time they're spending on the site". I am not an analytics expert, but here you would be talking about incorporating a custom dimension to the Analytics sent to GA (such as userid or a boolean telling if the user is or not logged in), but that would belong to the Google Analytics module.

Anonymous’s picture

My use Case is how many times a user profile has been visited to get results like most popular user in a week or month. Am no developer but i guess these kind of stats can be received from GA..

david_garcia’s picture

@DHamub: I have taken a look into the code and changing from nodes to an entity generic approach will not be that difficult. If you are not willing to do it yourself, you can find someone or contact the module developer to sponsor this changes. I can estimate this development to be about 10Hour dedication, at 30€/hour rate you can surely get someone to do this for around 300Eur.

Anonymous’s picture

Am just building a community based site in my free time and it's been two years since i started it :D If ever i become rich enough to spend that kinda money on developing a module i'll definitely do it and share it with everyone. Till then Cheers!