[tip] switching off analytics while in dev mode

9 views
Skip to first unread message

Warner Onstine

unread,
Nov 30, 2010, 9:12:27 AM11/30/10
to grails-startup...@googlegroups.com
I'll throw this first tip out there as it took a little bit for me to
figure out how to do this. I have google analytics (and another
analytics package I'm playing with) but I certainly don't want to have
those turned on while I'm developing as it could show some weird usage
patterns.

To do that I included this in my main.gsp layout file:

<g:if test="${!GrailsUtil.isDevelopmentEnv()}">
//Analytics code goes here
</g:if>

Pretty simple test but it now saves me from sorting out what traffic I
generated myself and what is real traffic.

Hope this saves someone some time.

-warner

Tomas Lin

unread,
Nov 30, 2010, 9:17:16 AM11/30/10
to grails-startup...@googlegroups.com
You can also exclude a range of IPs from your google analytics
tracking - this is a little cleaner since the code you execute will be
the same as production code and will allow you to use tools like
Tamper data.

http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55481

If you are using the google analytics plugin, you can specify a test
account for dev vs. test. vs. prod in config.groovy

google.analytics.webPropertyID = "UA-xxxxxx-x"

> --
> You received this message because you are subscribed to the Google Groups "Grails Startup Support Group" group.
> To post to this group, send email to grails-startup...@googlegroups.com.
> To unsubscribe from this group, send email to grails-startup-suppo...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/grails-startup-support-group?hl=en.
>
>

Warner Onstine

unread,
Nov 30, 2010, 9:21:47 AM11/30/10
to grails-startup...@googlegroups.com
That's true, I had never set that up and I'm also not sure if the
other analytics package I'm using (KISSMetrics) would allow me to do
that.

-warner

Marc Palmer

unread,
Dec 9, 2010, 3:46:20 AM12/9/10
to grails-startup...@googlegroups.com

On 30 Nov 2010, at 14:21, Warner Onstine wrote:

> That's true, I had never set that up and I'm also not sure if the
> other analytics package I'm using (KISSMetrics) would allow me to do
> that.
>

Hi Warner,

Good call. We actually parameterize our id for analytics per environment, which allows us to track usage on pre-production sites as well.

Marc

~ ~ ~
Marc Palmer
Blog > http://www.anyware.co.uk
Twitter > http://twitter.com/wangjammer5
Grails Rocks > http://www.grailsrocks.com


Warner Onstine

unread,
Dec 9, 2010, 9:06:30 AM12/9/10
to grails-startup...@googlegroups.com
On Thu, Dec 9, 2010 at 1:46 AM, Marc Palmer <li...@anyware.co.uk> wrote:
>
> On 30 Nov 2010, at 14:21, Warner Onstine wrote:
>
>> That's true, I had never set that up and I'm also not sure if the
>> other analytics package I'm using (KISSMetrics) would allow me to do
>> that.
>>
>
> Hi Warner,
>
> Good call. We actually parameterize our id for analytics per environment, which allows us to track usage on pre-production sites as well.

Hadn't thought of that, that's a great idea. Especially as I'm getting
ready for a limited dev beta. Good to see what's working and what
isn't to tweak for the next phase.

(And I'll be signing up for your beta shortly now that day-job has
calmed down a bit.)

Thanks!

-warner

>
> Marc
>
>
>
> ~ ~ ~
> Marc Palmer
> Blog         > http://www.anyware.co.uk
> Twitter      > http://twitter.com/wangjammer5
> Grails Rocks > http://www.grailsrocks.com
>
>
>
>
>
>

Reply all
Reply to author
Forward
0 new messages