snowplow / snowplow-java-tracker

Snowplow event tracker for Java. Add analytics to your Java desktop and server apps, servlets and games. (See also: snowplow-android-tracker)
http://snowplowanalytics.com
Apache License 2.0
23 stars 36 forks source link

Add a Snowplow interface with the ability to initialize and manage multiple trackers (close #340) #354

Closed mscwilson closed 2 years ago

mscwilson commented 2 years ago

This PR adds a couple of API improvements. A Snowplow class has been added with static methods for creating and managing multiple trackers.

Also, configuration classes have been added to bring this tracker more in line with the Android and C++ trackers. In conjunction with the Snowplow class, it's now very easy to create a tracker with default configuration, or to set custom choices.

github-actions[bot] commented 2 years ago

This pull request is for issue #340.

mscwilson commented 2 years ago

For the tracker creation, I'm not sure what to do with Subject. The default Subject config - whether config object or builder - sets the timezone. Therefore createTracker(trackerConfig, networkConfig, emitterConfig, new SubjectConfiguration()) and createTracker(trackerConfig, networkConfig, emitterConfig, null) aren't the same. Is it a problem if the timezone gets set? Might be unexpected.

I don't know why Subject has that one default setting. Bit messy.

matus-tomlein commented 2 years ago

@mscwilson I was going to suggest to just keep the behaviour to always set the default Subject with the current timezone (as does the Android tracker) but thinking about this a bit more I think that unless the user passes a Subject instance, we should not create a default one. Since we expect the tracker to run in a server setting, the default Subject properties would relate to the current server which is probably not what the user wants (they want the client timezone). So I would set the SubjectConfiguration to NULL in createTracker() functions where the Subject is not explicitly passed.