Javascript to post GE plugin events back to php/mysql

22 views
Skip to first unread message

mikemcc

unread,
Oct 5, 2009, 8:56:22 AM10/5/09
to KML Developer Support - Google Earth Plug-in
Hello.

I have about 150 target (corporate) customers spread worldwide and
generally I know who has what IP address so I can identify them and
offer them support if necessary. They are not overly computer-
literate. For example, if they need to install plugins, they are often
either unable/unwilling to follow download/installation prompts or
they need to ask a systems administrator to install plugins, so some
customers are inclined to give up. Often they won't tell us they have
had difficulty (loss of face); this is the worst scenario. Sometimes
they report that they can't display the GE API but don't say why not.
It's then painful to ask non-technical people to be specific about
their problem.

I imagine these are common scenarios for developers and I feel that
they need to be minimized to prevent all this fabulous API creativity
going to partial waste.

Obviously GE need to make the download and installation procedure for
the GE API as idiot-proof as possible (not that these people are
idiots). For example, the procedure shouldn't confuse (non-technical)
users by providing links to technical information for developers.

However, it would also really help if it was easy for us developers to
trap stats about what was happening on the client's PC. We could then
provide quick and relevant support to that client.

So is it please possible in this one thread and (later) in one section
of the documentation and/or one sample to specify how JavaScript can
listen and report back to php:

1. That the client has been told that the browser does not support the
GE API
2. That the client has been told that the GE API needs to be installed
3. That the client has selected "Get the GE plugin now"
4. That the client has selected "Download the GE plugin"
5. That the operating system has warned that the user doesn't have the
right to download.
6. That the operating system has asked permission to run an ActiveX
control.
7. That the GE plugin has been installed.
8. That an instance of the GE plugin has been loaded.
9. Any other similar scenarios which you think should & could be
trapped ?

Then we can get php to post to a database whatever stats we want to
trap and thereby ID which far-flung users need help and specifically
how to help them.

I know that Roman has addressed number 7 at:
http://groups.google.com/group/google-earth-browser-plugin/browse_thread/thread/546fc6a5887bb959?hl=en

but it would be great if there was one place where non-expert
developers could see how to deal with issues like: listening, polling,
the events which can be trapped and how to pass the info back to php.
I hope this makes sense. Thanks. Mike

Roman N

unread,
Oct 9, 2009, 5:38:04 PM10/9/09
to KML Developer Support - Google Earth Plug-in
Hi Mike,

Thanks for asking these important questions. My responses inline:

On Oct 5, 5:56 am, mikemcc wrote:
> 1. That the client has been told that the browser does not support the
> GE API

You could check for google.earth.isSupported() in createInstance's
failure callback for this.

> 2. That the client has been told that the GE API needs to be installed

You can check for google.earth.isInstalled() for this, no?

> 3. That the client has selected "Get the GE plugin now"

This is a good point--tracking clicks on the download button. Perhaps
a better approach for this is to give developers the ability to create
their own download links for the plugin? This would be a nice feature
request. Notification of when the user clicked the download button
seems too granular of an API method to me...

> 4. That the client has selected "Download the GE plugin"

Same as above, no?

> 5. That the operating system has warned that the user doesn't have the
> right to download.

This is slightly more difficult, but there are probably some HTML/JS
tricks that can be used to trap download errors. I personally don't
know of any.

> 6. That the operating system has asked permission to run an ActiveX
> control.

Not sure, but maybe IE has some method for this?

> 7. That the GE plugin has been installed.

google.earth.isInstalled, as above.

> 8. That an instance of the GE plugin has been loaded.

When createInstance's success callback is called, the plugin has
successfully loaded.

> 9. Any other similar scenarios which you think should & could be
> trapped ?
>
> Then we can get php to post to a database whatever stats we want to
> trap and thereby ID which far-flung users need help and specifically
> how to help them.

You can use AJAX for this. Or Google Analytics's "Events" if you need
very primitive tracking.

For example, I use Google Analytics to track plugin successes/failures
on EarthURL.org. Look for "pageTracker" in this JS file for an
example:

http://earthurl.org/static/js/front.js

>
> I know that Roman has addressed number 7 at:http://groups.google.com/group/google-earth-browser-plugin/browse_thr...
>
> but it would be great if there was one place where non-expert
> developers could see how to deal with issues like: listening, polling,
> the events which can be trapped and how to pass the info back to php.
> I hope this makes sense. Thanks. Mike

Right, this may be worth a section in the Developer's Guide or as an
article. Though, maybe having this in a groups thread is
sufficient :-)

Thanks Mike!
Roman

mikemcc

unread,
Oct 11, 2009, 11:55:06 AM10/11/09
to KML Developer Support - Google Earth Plug-in
Thanks Roman.

Yes I think that's a good idea - to let developers create their own
download links for the GE plugin.

At www.feedbacker.co.uk/menu/data/GEPluginInstallationInstructions.pdf
you can see my attempt to help far-flung users or their slightly more
technical colleagues install the plugin. I hope that helps someone. A
few points seem relevant to our thread:

1. On page 2 you can see that one can get 2 messages saying the same
thing.
2. On pages 2 (bottom) and 3 (top) you can see that one first gets a
message saying "Get the Google Earth plugin now" and then one saying
"Download the Google Earth plugin" - which seems unnecessary and
confusing. Hence my separate points 3 and 4 above. Unless we know
exactly where the user has got to, we can't easily help him/her.
3. I don't remember for sure, but the page where it says "Download the
Google Earth plugin" is probably the one which describes the GE plugin
to potential developers, which is far too much info for nervous users.
4. It's that bit harder to develop and provide this installation help
because it involves uninstalling and reinstalling the plugin
ourselves :-) which makes it even more important for Google to
simplify things for the user.

I sometimes feel a bit guilty asking for a cookbook solution to be
provided in the Developer's Guide or samples section, but:
- I do think it's just as important to make the GE plugin user-
friendly as it is to develop bells and whistles
- It can take many man months for novice developers to develop skills
in all areas: kml, ge api, html, php, mqsql, js, ajax, object-oriented
programming (?) etc, so most of us have "served our time at the
coalface" by now :-) and are probably not too lazy
- a short example of code (taking care to exclude things which are
irrelevant to the issue in question) is a great way to tech developers
more techniques
- there are so many other good bits of help and samples that it seems
logical to provide help and samples in these two important areas:
1. Trapping where the user has got to - using js
2. Passing the info to php (for posting to the developer's
stats table) using ajax

I have learned from examples how to pass data from php to js, but does
http://earthurl.org/static/js/front.js show me how to pass info back
from js to php ?

Thanks again.
Reply all
Reply to author
Forward
0 new messages