[Rails] Re: executing JS snippet from a controller
On Nov 14, 9:12 pm, Roy Zinn <li...@ruby-forum.com> wrote:
> Hi All,
>
> I want to execute JS snippet (Google Analytics tracking code) from a
> controller action.
>
> Is it possible to do this with ExecJS + therubyracer gem? If so, any
> code example will be highly appreciated.
>
> Is there another way to do such thing?
>
> I know this is not the best way to do this, but currently i'm not
> rendering any html after this action (it redirects automatically out of
> site) and I know it is possible to post to GA GIF request.
>
While you could technically execute some javascript code server side,
I doubt it will do what you want. Even if you can recreate enough of a
browser like environment for the google analytics code to run, it
still won't look to google analytics like the request came from that
user since you can't get at the cookie google analytics uses for its
tracking, it would come from a different ip address etc.
Fred
> Thanks,
> Roy
>
> --
> Posted viahttp://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home