forked from tpitale/staccato
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V4 Updates #1
Open
absolut-zero
wants to merge
6
commits into
master
Choose a base branch
from
v4-protocol
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
V4 Updates #1
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add `api_secret` and `client_id` requirement to Tracker. When they are nil, NoopTracker will be used instead. Require `client_id`. This is a big change, but I believe it the most appropriate approach to Google's v4 API. Because access to standard analytics `client_id` is at least partially a matter of end-user consent, I believe it would be wrong for this library to automatically generate a missing `client_id`. Users of the gem may know that it is reasonable and permissible to generate a missing `client_id`, but they should manage that themselves. Other general updates: * Add many specs for V4::Tracker and V4::Event. * Some changes to event method names to use nomenclature more similar to the Measurement API v4 documentation. * Added `uri` methods to the Net::HTTP and Validation adapters, for both testing and debugging. * Experimental support for auto-generating `timestamp_micros`. * Moved all of the default_adapter related methods from V4 and V4::Tracker into V4::AdapterDefaults, and then extended V4 and V4::Tracker with them. For V4::Tracker, this moves the methods up to the class level, but this also enables memoization at the class level. * Updated `Staccato::Adapter::Validation` to accept a custom uri. Updates to Event: * Adds `Event.param` DSL, backward-compatible with `FIELDS`. This is a step towards changing the `Event` module to a generic superclass. * Return custom parameters from `#as_json`, in addition to the standard recommended parameters. * Recursively encode `#as_json` parameter values, eg: `items: [...]`. * Correctly encode Item, without requiring ActiveSupport. * Add `#engagement_time_msec` and `#session_id` as recommended parameters. * Add `#update`, for adding and updating parameters. * Add `#apply_defaults`, for adding missing parameters to an event. Updates to Tracker * Add a bang-method version of each dynamically generated event type method, to immediately post all enqueued events. * Add `tracker << event` as an alternative form of `#add`. * Update `#add` to accept simple String, Symbol, and Hash events. * Update `#add` to accept already constructed Event objects. * Update `#add` to reverse merge with `#default_event_params`. * Update `#event` to return a frozen duplicate array. This protects against events being added directly. `#add`, `#<<`, `#clear`, and `#trim` should provide adequate support for generic event data, so direct mutation of `#events` shouldn't be necessary. * Update `#post` visibility to be public. * Update `#post` to send in batches of 25 events, returning an array. * Update `#post` to clear `#events` as they are posted. * Add `#default_event_params`, which are applied to each event. * Add basic support for `#user_id` and `#user_properties`. * Convert `NoopTracker` to a subclass of `Tracker`. * Clear `#events` after successfully calling `#track`. * Update `#adapters` to memoize the default adapter on the first access. This simplifies adding a new adapter without losing the default. * Document that `#validate!` sends only the first 25 events. * Document that `#validate!` doesn't clear the #events array. * Update `#validate!` to use the class-memoized validation adapter. * Update `#add_adapter` to accept `:net_http`, `:validation`, or `:logger` with optional logger arguments. * Add `tracker.clear` to clear the events array * Add `tracker.trim` to drop the first events from the events array
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.