[wp-hackers] Collecting de-identified environment info via plugin

Otto otto at ottodestruct.com
Fri Nov 13 19:51:24 UTC 2009


How important is it to you that the identifier not change, ever?

If it's okay for it to almost never change, then just run md5 over the
siteurl. Most people don't move their sites around often, that value
will rarely change.

If you need to know, for sure, that the value won't change unless
somebody specifically tries to change it, then I suggest rolling your
own. Something like this would work:

$plugin_identifier = get_option('plugin_id_whatever');
if (empty($plugin_identifier)) {
  $plugin_identifier = wp_generate_password(64);
  update_option('plugin_id_whatever', $plugin_identifier);
}

Basically generate a randomized 64 char string and save it. It's only
ever generated once, and unless the user manually goes into the
database to delete or change the option, it'll never change.

-Otto
Sent from Memphis, TN, United States


On Fri, Nov 13, 2009 at 12:37 PM, Matt Jacob <matt at mattjacob.com> wrote:
> As a plugin developer, it seems like it would be useful to collect
> information about the environments in which my plugin is running
> (things like PHP version, WP version, plugin version, etc.). This
> would obviously help me tailor future releases to better meet the
> needs of my users. Data would only be collected after the user opts
> in, and they would be able to opt out at any time.
>
> Now I'm curious if WordPress generates some kind of unique
> "installation ID" or if I'll have to come up with something myself. I
> only care to collect de-identified data, as I have no use for the IP
> address, hostname of the server, URI of the WP installation, etc. The
> less information I have about the user, the better.
>
> Has anyone done this in the past? Any pointers or suggestions?
>
> Matt
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list