Discussion:
Ruby CGI script <=> Java chatbot server - need to run some Javascript code for FaceBook Analytics
Philip Rhoades
2018-08-08 10:19:52 UTC
Permalink
People,

I have this chatbot set up:

https://www.facebook.com/PhiRhoChat

and it stopped working sometime recently for NEW chats - I can't work
out why Messenger continues to work for my test FB account but not for
new chatters - there are alerts to get the app reviewed again although
under "App Review" it says: "Your app is currently live and available to
the public."

Anyway, I want to add this Javascript stuff to the Ruby script somehow
so the FB analytics will work so I might have a better chance of finding
out why NEW chats are not making it to the Ruby script . .

Is it possible?

Thanks,

Phil.
--
Philip Rhoades

PO Box 896
Cowra NSW 2794
Australia
E-mail: ***@pricom.com.au

Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Hassan Schroeder
2018-08-08 16:47:06 UTC
Permalink
Anyway, I want to add this Javascript stuff to the Ruby script somehow so
the FB analytics will work
What "Javascript stuff"? What does it do?

There are at least a couple of gems ("johnson" and "javascript") that
address incorporating JS into Ruby code. I've used the former but it's
~8 years unmaintained, and the latter also seems broken (on 2.5.1 at
least).

It might be easier to figure out what data the JS collects and ship that
back to the appropriate endpoint from Ruby...
--
Hassan Schroeder ------------------------ ***@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Philip Rhoades
2018-08-09 03:48:53 UTC
Permalink
Hassan,
Post by Hassan Schroeder
Anyway, I want to add this Javascript stuff to the Ruby script somehow so
the FB analytics will work
What "Javascript stuff"? What does it do?
There are at least a couple of gems ("johnson" and "javascript") that
address incorporating JS into Ruby code. I've used the former but it's
~8 years unmaintained, and the latter also seems broken (on 2.5.1 at
least).
It might be easier to figure out what data the JS collects and ship that
back to the appropriate endpoint from Ruby...
Yes, I was wondering if that were possible - the other thought I had was
that the code could be incorporated into cgi.header in my ruby script?

Thanks!
Phil.

<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{your-app-id}',
cookie : true,
xfbml : true,
version : '{api-version}'
});

FB.AppEvents.logPageView();

};

(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
--
Philip Rhoades

PO Box 896
Cowra NSW 2794
Australia
E-mail: ***@pricom.com.au

Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Loading...