exclude admins page views from google analytics data.

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
5/3/2012 11:50:46 AM
Gravatar
Total Posts 192

exclude admins page views from google analytics data.

hi Joe.

currently every page visit is stored in Google Analytics database.

I wanted to exclude admin page views. (specially that all module settings page views and page edit views and ... were recorded. it's not good for a new site where admin page visit rates are high)

this is what I did:

I added <add key="GoogleAnalyticsRolesToExclude" value="Admin"/> to user.config

then in AnalyticsAsyncBottomScript:

added: private string googleAnalyticsRolesToExclude = string.Empty;

then in oninit, right after if (HttpContext.Current == null) { return; }:

if (ConfigurationManager.AppSettings["GoogleAnalyticsRolesToExclude"] != null)
{
googleAnalyticsRolesToExclude = ConfigurationManager.AppSettings["GoogleAnalyticsRolesToExclude"].ToString();
}

then in first line of Render():

if (!string.IsNullOrEmpty(googleAnalyticsRolesToExclude))
if (WebUser.IsInRoles(googleAnalyticsRolesToExclude))
return;

 

all this must be done for AnalyticsAsyncTopScript too.

what do you think about this? and do you think it can go to repository?

5/3/2012 12:31:00 PM
Gravatar
Total Posts 18439

Re: exclude admins page views from google analytics data.

I've just implemented it and pushed it to the repository since people have requested this. I guess if your site doesn't get much traffic you are worried that admin traffic is inflating the numbers but once you get a lot of traffic it doesn't really matter.

Myself I would not use that. It seems arbitrary to not track that data since visits by the same users who are not logged in but happen to be in those roles (if they were logged in) will still be tracked, so you are only not tracking them when they sign in.

Google Analytics provides lots of features such as advanced segments that would allow you to filter out things based on the path of the page the ip address and custom variables, we already pass a custom variable for admin users and others have used this as mentioned on this thread.

My feeling about it is its best to track everything, you can filter out things you track but if you don't track it you can never get that data. What if you want to make custom reports specifically about how your editors are using the site? You won't be able to since you won't have the data.

Best,

Joe

5/4/2012 7:08:10 AM
Gravatar
Total Posts 192

Re: exclude admins page views from google analytics data.

I didn't know about segments, and I was looking for a quick solution! that's why I did that.

now I will remove roles from the config.

Tongue Out

You must sign in to post in the forums. This thread is closed to new posts.