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.

Thanks,
Roy

--
Posted via http://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.

Search Discussions

  • Frederick Cheung at Nov 14, 2011 at 10:15 pm

    On Nov 14, 9:12 pm, Roy Zinn 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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedNov 14, '11 at 9:12p
activeNov 14, '11 at 10:15p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Roy Zinn: 1 post Frederick Cheung: 1 post

People

Translate

site design / logo © 2021 Grokbase