This can be any string or a UUID, with a few conditions (in order of most important to least):
It cannot be personally identifiable information or any form of sensitive information
It would be the same for any given user, even if they close and then reopen rhino/ grasshopper (so system based, not session-based or random)
It would be different for different users
It seems like the guys at McNeel are making this super easy in Rhino 6, but the function doesn’t exist in Rhino 5! In the meantime, while working with Rhino 5, what is something that can be used for a user id/ client id? And/or what does the function in Rhino 6 use?
Perhaps adding something like this to your plug-in object is sufficient?
/// <summary>
/// Returns a GUID that allows events to be aggregated by user.
/// There is no way to determine who the end user is based on this
/// GUID, unless the user tells you their ID.
/// </summary>
public static Guid GoogleAnalyticsUserId
{
get
{
var id = Instance.Settings.GetGuid("GoogleAnalyticsUserId", Guid.Empty);
if (id == Guid.Empty)
{
id = Guid.NewGuid();
Instance.Settings.SetGuid("GoogleAnalyticsUserId", id);
}
return id;
}
}
I understand the idea of singleton pattern and/ or using a static class, but I just want to confirm that I understand what the code actually does on the client’s computer…
It basically just stores each user’s unique key in the user’s registry, correct? If the key hasn’t been created yet, (or is corrupted/ erased), it will generate and store a new key. By virtue of being in the registry, the key will have strong persistence, and be the same even if rhino is closed and re-opened, or if the computer is restarted, etc.
@pagarcia, if it is helpful, here is how I implemented in C#. It uses the google measurement protocol, which is about as “low-level” as GA gets… I execute all the web calls on a sep. thread so it can happen in the background and the program doesn’t hang.
I’ve set mine up to automatically read the plugin version number. All my components call the method defined here, with it’s two parameters. google analytics.cs (3.1 KB)
Thank you Matthew! I’ll give it a try. This is a class that I should add to my project, compile it and then communication will be set up between the user using it and my Google Analytics account, right?
If you’re using C++ then you’ll need to rewrite the functions, as they were written for C#.
You’ll need to get a “property id” from google analytics and hard-code it into the function.
The class handles the actual act of sending of the data to Google Analytics, but you still need to call the function when the trackable event is triggered by the user. You’ll also need tell it what to send (via the two parameters in the function).
Definitely read through the google help page regarding the Measurement Protocol, (which I linked to above) especially if you’ve never used GA before… GA is a pretty nice platform with the ability to receive a range of information, you’ll have to choose what to send and how to structure it. For example, I only really care about what components are being used and roughly how much “work” they are doing for the user… So I chose to implement it like this:
{ "ea", "calculation" }, //event action - set as "calculation", indicating that the hit is being generated during calculation of a solution
{ "ec", nodeReportingHit }, //event category - set as name of the node generating the "hit"
{ "ev", hitValueString }, //event value - set as number, indicates the number of items processed
Definitely spend some time thinking about what analytics info is important to you and designing an appropriate schema for it.