You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Wouter de Vaal <wo...@gmail.com> on 2010/09/12 10:06:53 UTC

render google analytics at end of head

Hi,

For some time now, google has changed the way you can incorporate an
analytics snippet. The former one was slow and synchronous, the current one
is asynchronous, so I would like to use that one. However you have to place
it just before </head>. Placing it in our base page at the end of
wicket:head doesn't work as wicket pushes it's own extra's for ajax related
stuff. Is there a way to make sure the analytics snippet goes to the exact
end of the head section?

Thanks,
Wouter

Re: render google analytics at end of head

Posted by Alexander Morozov <al...@gmail.com>.
I think this is not hack, but "raw" post-processing :) Strict processing can
be done with XsltTransformerBehavior or as Martin said, you can use JS.

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/render-google-analytics-at-end-of-head-tp2536175p2536224.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: render google analytics at end of head

Posted by Don Ferguson <do...@gmail.com>.
FWIW, I've been using async analytics for months with the snippet in the middle of the head section, and it seems to work just fine.  I'd be curious to know why it matters...
One tip for using analytics with wicket: you can pass an explicit (logical) url to track -- just add a string after _trackPageview.  This is useful for instrumenting wicket apps where the actual URL may not contain useful tracking information.

On Sep 12, 2010, at 2:53 AM, Wouter de Vaal wrote:

> Hm, interesting, on this page:
> http://www.google.com/support/analytics/bin/answer.py?hl=en_US&answer=174090&utm_id=ad
> they say:
> "
> Once you find the code snippet, copy and paste it into your web page, *just
> before the closing* </head> tag
> "
> 
> This is why I'm asking... If I just dump it in the head in my base page
> html, wicket still puts other script tags after it (default wicket js
> libraries for ajax calls).
> 
> Wouter
> 
> 
> 2010/9/12 Martin Grigorov <mg...@apache.org>
> 
>> What about using plain javascript to create the new <script> and append it
>> in the <head> ?
>> This is what GA recommend in their documentation.
>> 
>> see http://code.google.com/chrome/extensions/tut_analytics.html for
>> example
>> 
>> On Sun, Sep 12, 2010 at 11:27 AM, Wouter de Vaal <wo...@gmail.com>
>> wrote:
>> 
>>> This looks like hacking into the output string buffer? That seems a bit
>> of
>>> a
>>> dirty hack to me, that would involve splitting up just before </head> and
>>> appending code their.
>>> 
>>> I hope there is a better way than this...
>>> 
>>> Wouter
>>> 
>>> 2010/9/12 Alexander Morozov <al...@gmail.com>
>>> 
>>>> 
>>>> Hi!
>>>> 
>>>> Have you looked at IResponseFilter ?
>>>> 
>>>> --
>>>> View this message in context:
>>>> 
>>> 
>> http://apache-wicket.1842946.n4.nabble.com/render-google-analytics-at-end-of-head-tp2536175p2536213.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> check out https://www.memolio.com
>>> 
>> 
> 
> 
> 
> -- 
> check out https://www.memolio.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: render google analytics at end of head

Posted by Wouter de Vaal <wo...@gmail.com>.
Hm, interesting, on this page:
http://www.google.com/support/analytics/bin/answer.py?hl=en_US&answer=174090&utm_id=ad
they say:
"
Once you find the code snippet, copy and paste it into your web page, *just
before the closing* </head> tag
"

This is why I'm asking... If I just dump it in the head in my base page
html, wicket still puts other script tags after it (default wicket js
libraries for ajax calls).

Wouter


2010/9/12 Martin Grigorov <mg...@apache.org>

> What about using plain javascript to create the new <script> and append it
> in the <head> ?
> This is what GA recommend in their documentation.
>
> see http://code.google.com/chrome/extensions/tut_analytics.html for
> example
>
> On Sun, Sep 12, 2010 at 11:27 AM, Wouter de Vaal <wo...@gmail.com>
> wrote:
>
> > This looks like hacking into the output string buffer? That seems a bit
> of
> > a
> > dirty hack to me, that would involve splitting up just before </head> and
> > appending code their.
> >
> > I hope there is a better way than this...
> >
> > Wouter
> >
> > 2010/9/12 Alexander Morozov <al...@gmail.com>
> >
> > >
> > > Hi!
> > >
> > > Have you looked at IResponseFilter ?
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/render-google-analytics-at-end-of-head-tp2536175p2536213.html
> > > Sent from the Wicket - User mailing list archive at Nabble.com.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > check out https://www.memolio.com
> >
>



-- 
check out https://www.memolio.com

Re: render google analytics at end of head

Posted by Martin Grigorov <mg...@apache.org>.
What about using plain javascript to create the new <script> and append it
in the <head> ?
This is what GA recommend in their documentation.

see http://code.google.com/chrome/extensions/tut_analytics.html for example

On Sun, Sep 12, 2010 at 11:27 AM, Wouter de Vaal <wo...@gmail.com> wrote:

> This looks like hacking into the output string buffer? That seems a bit of
> a
> dirty hack to me, that would involve splitting up just before </head> and
> appending code their.
>
> I hope there is a better way than this...
>
> Wouter
>
> 2010/9/12 Alexander Morozov <al...@gmail.com>
>
> >
> > Hi!
> >
> > Have you looked at IResponseFilter ?
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/render-google-analytics-at-end-of-head-tp2536175p2536213.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> check out https://www.memolio.com
>

Re: render google analytics at end of head

Posted by Wouter de Vaal <wo...@gmail.com>.
This looks like hacking into the output string buffer? That seems a bit of a
dirty hack to me, that would involve splitting up just before </head> and
appending code their.

I hope there is a better way than this...

Wouter

2010/9/12 Alexander Morozov <al...@gmail.com>

>
> Hi!
>
> Have you looked at IResponseFilter ?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/render-google-analytics-at-end-of-head-tp2536175p2536213.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
check out https://www.memolio.com

Re: render google analytics at end of head

Posted by Alexander Morozov <al...@gmail.com>.
Hi!

Have you looked at IResponseFilter ?

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/render-google-analytics-at-end-of-head-tp2536175p2536213.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org