### Install analytics-ruby Gem Source: https://github.com/segmentio/analytics-ruby/blob/master/README.md Instructions for installing the analytics-ruby gem from rubygems.org into your Gemfile or directly using the gem install command. ```ruby gem 'analytics-ruby' ``` ```ruby gem install 'analytics-ruby' ``` -------------------------------- ### Ruby: Update install docs Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md The installation documentation has been updated to provide clearer and more current instructions for setting up the library. ```Ruby # readme: updated install docs ``` -------------------------------- ### Example JavaScript Track Event Source: https://github.com/segmentio/analytics-ruby/blob/master/README.md A JavaScript snippet demonstrating how to track an 'Order Completed' event with a price property. ```javascript analytics.track('Order Completed', { price: 99.84 }) ``` -------------------------------- ### Example SQL Query for Order Completed Source: https://github.com/segmentio/analytics-ruby/blob/master/README.md An SQL query to select all order completed events, ordered by price in descending order. ```sql select * from app.order_completed order by price desc ``` -------------------------------- ### Alias User Source: https://github.com/segmentio/analytics-ruby/blob/master/README.md Provides an example of how to alias a user, which is useful for merging user histories. ```ruby analytics.alias(user_id: 41) ``` -------------------------------- ### RSpec Configuration for Segment Test Queue Source: https://github.com/segmentio/analytics-ruby/blob/master/README.md Provides an example of how to configure RSpec to automatically reset the Segment test queue before each test. This ensures test isolation and prevents data leakage between tests. ```ruby RSpec.configure do |config| config.before do Analytics.test_queue.reset! end end ``` -------------------------------- ### Initialize Segment Analytics Client Source: https://github.com/segmentio/analytics-ruby/blob/master/README.md Demonstrates how to create an instance of the Segment Analytics object by providing your write key. ```ruby analytics = Segment::Analytics.new(write_key: 'YOUR_WRITE_KEY') ``` -------------------------------- ### Initialize Segment with Test Queue Source: https://github.com/segmentio/analytics-ruby/blob/master/README.md Demonstrates how to initialize the Segment Ruby client with the `test: true` option to enable the test queue functionality. This allows all outgoing requests to be stored for later inspection without being sent to Segment. ```ruby client = Segment::Analytics.new(write_key: 'YOUR_WRITE_KEY', test: true) ``` -------------------------------- ### Ruby Analytics Initialization Check Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Provides an `.initialized?` method to check if the analytics client has been properly set up. This helps prevent errors by ensuring the client is ready before sending events. ```Ruby require 'analytics-ruby' analytics = Segment::Analytics.new({ write_key: 'YOUR_WRITE_KEY' }) if analytics.initialized? puts 'Analytics client is initialized.' else puts 'Analytics client is not initialized.' end ``` -------------------------------- ### Ruby Analytics Namespace and Instance Creation Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Introduces the `Segment::Analytics` namespace and a creator method for multiple instances, moving away from a singleton pattern. This enhances flexibility in managing analytics configurations. ```Ruby require 'analytics-ruby' # Create multiple instances analytics1 = Segment::Analytics.new({ write_key: 'KEY1' }) analytics2 = Segment::Analytics.new({ write_key: 'KEY2' }) # Use the Segment::Analytics namespace Segment::Analytics.track({ user_id: 'user123', event: 'Signed Up' }) ``` -------------------------------- ### Ruby: Add experimental CLI Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Introduces an experimental command-line interface (CLI) for interacting with the Segment Analytics library. ```Ruby # Adding an (experimental) CLI ``` -------------------------------- ### Ruby Analytics Configuration and Namespace Handling Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Removes the global `Analytics` constant in favor of configuration-based initialization. Users must now explicitly configure the analytics client or add `Analytics = AnalyticsRuby` to their config. ```Ruby require 'analytics-ruby' # Option 1: Configure directly analytics = Segment::Analytics.new({ write_key: 'YOUR_WRITE_KEY', on_error: Proc.new { |error, context| puts "Error: #{error.message}" } }) # Option 2: Add to config if you need the global `Analytics` constant # Analytics = Segment::Analytics # Analytics.configure { |config| config.write_key = 'YOUR_WRITE_KEY' } ``` -------------------------------- ### Track User Event Source: https://github.com/segmentio/analytics-ruby/blob/master/README.md Illustrates how to track a user event, such as 'Created Account', along with associated properties. ```ruby analytics.track(user_id: 42, event: 'Created Account') ``` -------------------------------- ### Ruby Analytics String Keys for Calls Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Allows `init`, `track`, `identify`, and `alias` methods to accept strings as keys, providing more flexibility in how event data is structured. ```Ruby analytics.track('user123', 'Signed Up', 'plan' => 'Free') analytics.identify('user123', 'email' => 'test@example.com', 'name' => 'Test User') ``` -------------------------------- ### Ruby Analytics Adapter Reversion Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Removes the Typhoeus adapter and reverts to the default adapter for HTTP requests. This simplifies dependencies and potentially improves compatibility. ```Ruby # The library now uses the default HTTP adapter. # If you previously configured Typhoeus, you may need to adjust your setup. ``` -------------------------------- ### Ruby Analytics Exception Handling for Uninitialized Tracks Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Fixes a thrown exception when `track` is called on a non-initialized analytics client. The library now handles this scenario more gracefully. ```Ruby # The library now prevents exceptions on uninitialized tracks. # It's still best practice to initialize the client before use. ``` -------------------------------- ### Ruby: Require `version` module first Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Ensures that the `version` module is required before other parts of the library, preventing potential `NameError` exceptions. ```Ruby # Require `version` module first. ``` -------------------------------- ### Ruby Analytics Group, Page, and Screen Calls Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Adds support for `.group()`, `.page()`, and `.screen()` calls, enabling richer user context and event tracking within the application. These methods help categorize user actions and views. ```Ruby analytics.group('group123', { name: 'Awesome Group', plan: 'Enterprise' }) analytics.page('Homepage', { title: 'Welcome!', path: '/home' }) analytics.screen('Profile Screen', { name: 'User Profile', userId: 'user123' }) ``` -------------------------------- ### Ruby: Add test option for easier testing Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md A new test option has been added to facilitate easier testing of the library. This likely involves mockability or specific testing utilities. ```Ruby # Add test option for easier testing ``` -------------------------------- ### Ruby Analytics File Renaming for Bundling Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Renames all library files to facilitate proper bundling and dependency management within Ruby projects. ```Ruby # This change affects the internal file structure and requires no code changes from the user. ``` -------------------------------- ### Ruby: Add commander as dependency for CLI Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md The `commander` gem has been added as a dependency to support the command-line interface (CLI) functionality. ```Ruby # adding commander as dep (for CLI) ``` -------------------------------- ### Ruby Analytics Support for 1.8.7 Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Adds support and tests for Ruby version 1.8.7, ensuring compatibility with older Ruby environments. ```Ruby # No specific code snippet required, this is a compatibility update. # Ensure your environment meets the version requirements if using 1.8.7. ``` -------------------------------- ### Ruby: Emit logs when in-memory queue is full Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Adds functionality to emit logs when the in-memory queue becomes full, providing visibility into potential bottlenecks. ```Ruby # Emit logs # when in-memory queue is full ``` -------------------------------- ### Ruby Analytics Rakefile and Renaming Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Includes updates to the Rakefile and internal renaming for better project structure and build processes. ```Ruby # This change is related to the project's build system and requires no user code modification. ``` -------------------------------- ### Ruby: Handle HTTP status code failure appropriately Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Ensures that HTTP status code failures are handled appropriately, likely involving proper error reporting or retry logic based on the status code. ```Ruby # Handle # HTTP status code failure appropriately ``` -------------------------------- ### Identify User with Traits Source: https://github.com/segmentio/analytics-ruby/blob/master/README.md Shows how to identify a user by their user ID and associate traits such as email, first name, and last name. ```ruby analytics.identify(user_id: 42, traits: { email: 'name@example.com', first_name: 'Foo', last_name: 'Bar' }) ``` -------------------------------- ### Ruby: Override `respond_to_missing` for mocking Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Overrides `respond_to_missing` instead of `respond_to?` to facilitate mocking the library in tests. This improves the testability of the library. ```Ruby # Override `respond_to_missing` instead of `respond_to?` to facilitate mock the library in tests. ``` -------------------------------- ### Ruby: Add executables to spec Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Executables have been added to the specification, likely for testing or packaging purposes related to the CLI. ```Ruby # add executables to spec ``` -------------------------------- ### Ruby Analytics ClassMethods for Extensibility Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Adds `ClassMethods` to the analytics library, providing a more extensible interface for developers to build upon. ```Ruby # Usage of ClassMethods is typically internal or for advanced customization. # Example of how it might be structured: # module Segment # module Analytics # module ClassMethods # def track(traits) # # ... implementation ... # end # end # end # end ``` -------------------------------- ### Ruby Analytics ISO8601 Timestamp Formatting Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Passes `Time` values as ISO8601 timestamp strings, ensuring consistent and standardized date formatting for analytics events. ```Ruby analytics.track({ user_id: 'user123', event: 'Event with ISO Timestamp', timestamp: Time.now.iso8601 }) ``` -------------------------------- ### Ruby: Allow no name in page/screen Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Allows the `page` and `screen` methods to be called without a name parameter, providing more flexibility in event tracking. ```Ruby # fix: page/screen to allow no name ``` -------------------------------- ### Ruby Analytics Flush Method Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Introduces a `flush` method to immediately send any queued analytics events. This is useful for ensuring data is sent before an application exits. ```Ruby # Assuming analytics client is initialized # ... send some events ... analytics.flush ``` -------------------------------- ### Ruby: Include optional options hash in calls Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Ensures that an optional options hash is included in method calls, allowing for more configurable behavior. ```Ruby # fix: include optional options hash in calls ``` -------------------------------- ### Stubbing Requests in Ruby Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Allows stubbing of HTTP requests by setting the STUB environment variable. This is useful for testing or preventing actual server calls. ```Ruby ENV['STUB'] = 'true' ``` -------------------------------- ### Ruby: Deprecate Ruby <2.0 support Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Support for Ruby versions older than 2.0 has been deprecated. This encourages users to upgrade to more recent Ruby versions for continued support. ```Ruby # Deprecate # Ruby <2.0 support ``` -------------------------------- ### Ruby: Ensure error handler called before flush finishes Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Fixes an issue where the error handler might not be called before the `Client#flush` method completes, ensuring proper error propagation. ```Ruby # Fix: Ensure error handler is called before Client#flush finishes. ``` -------------------------------- ### Ruby: Update to Ruby 3.2 Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md This entry indicates an update to support Ruby version 3.2. It signifies a commitment to maintaining compatibility with newer Ruby environments. ```Ruby # Update to Ruby 3.2 ``` -------------------------------- ### Ruby: Remove old rubys from travis-ci Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Removes configurations for old Ruby versions from Travis CI, streamlining the continuous integration process. ```Ruby # travis-ci: remove old rubys ``` -------------------------------- ### Inspect Segment Test Queue Contents Source: https://github.com/segmentio/analytics-ruby/blob/master/README.md Shows how to access and inspect the contents of the Segment test queue. It covers retrieving all queued messages, specifically track events, and demonstrates that other event types (alias, group, identify, page, screen) return empty arrays when no such events have been queued. ```ruby client.test_queue # => # client.track(user_id: 'foo', event: 'bar') client.test_queue.all # [ # { # :context => { # :library => { # :name => "analytics-ruby", # :version => "2.2.8.pre" # } # }, # :messageId => "e9754cc0-1c5e-47e4-832a-203589d279e4", # :timestamp => "2021-02-19T13:32:39.547+01:00", # :userId => "foo", # :type => "track", # :event => "bar", # :properties => {} # } # ] client.test_queue.track # [ # { # :context => { # :library => { # :name => "analytics-ruby", # :version => "2.2.8.pre" # } # }, # :messageId => "e9754cc0-1c5e-47e4-832a-203589d279e4", # :timestamp => "2021-02-19T13:32:39.547+01:00", # :userId => "foo", # :type => "track", # :event => "bar", # :properties => {} # } # ] # Other available methods client.test_queue.alias # => [] client.test_queue.group # => [] client.test_queue.identify # => [] client.test_queue.page # => [] client.test_queue.screen # => [] ``` -------------------------------- ### Ruby: Don't assume all errors are 'ConnectionError's Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Corrects the error handling logic to avoid assuming all errors are of type 'ConnectionError'. This improves the robustness of error management. ```Ruby # Don't assume # all errors are 'ConnectionError's ``` -------------------------------- ### Ruby: Enable overriding transport options Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md This feature allows overriding transport options when initializing the Transport. This provides flexibility in configuring network requests. ```Ruby # Enable overriding transport Pass options when initializing Transport ``` -------------------------------- ### Ruby Analytics Properties as Hash Check Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Includes a check to ensure that the `properties` argument passed to analytics calls is a Hash. This prevents errors caused by incorrect data types. ```Ruby # The library now validates that properties is a Hash. # If you pass something else, an error might be raised or the event ignored. # Example of correct usage: analytics.track('user123', 'Event', { 'key' => 'value' }) ``` -------------------------------- ### Reset Segment Test Queue Source: https://github.com/segmentio/analytics-ruby/blob/master/README.md Demonstrates how to clear the Segment test queue using the `reset!` method. This is crucial for ensuring a clean state before each test execution to avoid interference from previous test runs. ```ruby client.test_queue.reset! client.test_queue.all # => [] ``` -------------------------------- ### Ruby: Better logging Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Implements improvements to the logging mechanism, providing more detailed or informative logs for debugging and monitoring. ```Ruby # Better # logging ``` -------------------------------- ### Ruby: Fix rescuing timeouts Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Corrects the exception handling for timeouts, ensuring that timeout errors are caught and managed appropriately. ```Ruby # Fix rescuing timeouts ``` -------------------------------- ### Ruby Analytics Mocked Tests Update Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Updates tests to use mocks, improving test reliability and isolation. ```Ruby # This is an internal testing improvement and does not affect user code. ``` -------------------------------- ### Ruby: Update supported Ruby versions Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md This update adjusts the supported Ruby versions, including adding support for 2.4, 2.5, 2.6, and 2.7, while removing support for older versions (2.0, 2.1, 2.2, 2.3). ```Ruby # Update supported Ruby versions (2.4, 2.5, 2.6, 2.7), remove unsupported Ruby versions (2.0, 2.1, 2.2, 2.3) ``` -------------------------------- ### Ruby: Fix category param on #page and #screen Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Corrects the handling of the `category` parameter in the `#page` and `#screen` methods, ensuring it is processed correctly. ```Ruby # fix: category param on #page and #screen ``` -------------------------------- ### Ruby: Reuse TCP connections Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Implements the reuse of TCP connections for performance improvements. This can reduce the overhead of establishing new connections for each request. ```Ruby # Reuse # TCP connections ``` -------------------------------- ### Ruby Analytics MultiJson Dependency Update Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Updates the library to support MultiJson version 1.0, ensuring compatibility with the latest JSON parsing capabilities. ```Ruby # No direct code snippet needed, this is a dependency update. # Ensure MultiJson is installed or available in your environment. ``` -------------------------------- ### Ruby: Revert 'reuse TCP connections' to fix EMFILE errors Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Reverts the 'reuse TCP connections' feature to resolve EMFILE errors. This indicates a potential issue with resource management when connections are reused. ```Ruby # Revert 'reuse # TCP connections' to fix EMFILE errors ``` -------------------------------- ### Ruby: Add exponential backoff to retries Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Implements exponential backoff for retries, which is a strategy to gradually increase the delay between retries after failed attempts. This can improve success rates for transient network issues. ```Ruby # Add # exponential backoff to retries ``` -------------------------------- ### Ruby: Move timeout retry above output Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Adjusts the order of operations to move the timeout retry logic above the output processing, potentially improving error handling during timeouts. ```Ruby # Move timeout retry above output ``` -------------------------------- ### Ruby Analytics API Spec Compliance Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Ensures data sent matches Segment's new API specification, including proper formatting of timestamps and properties. This is crucial for data integrity and compatibility. ```Ruby # Example of sending data conforming to the API spec analytics.track({ user_id: 'user123', event: 'Updated Profile', timestamp: Time.now.iso8601, properties: { plan: 'Free', email: 'test@example.com' } }) ``` -------------------------------- ### Ruby Analytics Faraday Timeout Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Adds a Faraday timeout configuration to handle slow network responses gracefully. This prevents requests from hanging indefinitely. ```Ruby require 'analytics-ruby' analytics = Segment::Analytics.new({ write_key: 'YOUR_WRITE_KEY', faraday_options: { request: { timeout: 5 } } # Timeout in seconds }) ``` -------------------------------- ### Ruby Analytics Connection Retry Backoff Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Implements a `sleep` backoff strategy between connection retries to handle network issues more robustly. This prevents overwhelming the server during temporary outages. ```Ruby # The library internally handles connection retries with backoff. # No direct code snippet is needed for this feature, but it improves reliability. ``` -------------------------------- ### Ruby Analytics Consumer Thread Shutdown Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Allows the consumer thread to shut down gracefully, preventing it from remaining active in hot deploy scenarios and resolving potential memory leaks, particularly on JRuby. ```Ruby # Example of shutting down the consumer thread (implementation details may vary) # analytics.shutdown ``` -------------------------------- ### Ruby Analytics Logging with Logger or Rails.logger Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Enables logging for the analytics library, allowing integration with a standard Logger instance or `Rails.logger` if available. This aids in debugging and monitoring analytics events. ```Ruby require 'logger' # Using a standard Logger instancelog = Logger.new(STDOUT)analytics = Segment::Analytics.new({ write_key: 'KEY', logger: log }) # Using Rails.logger (if available) # analytics = Segment::Analytics.new({ write_key: 'KEY' }) ``` -------------------------------- ### Ruby: Add missing 'Forwardable' requirement Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Adds the missing `Forwardable` requirement, which is likely necessary for certain functionalities that rely on delegating methods. ```Ruby # Add missing # 'Forwardable' requirement ``` -------------------------------- ### Ruby Analytics User ID Semantics Fix Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Corrects the `user_id.to_s` semantics, ensuring that user IDs are consistently converted to strings, preventing potential errors. ```Ruby # The library now correctly handles user_id.to_s. # Ensure you pass user IDs as strings or objects that respond to to_s. analytics.track({ user_id: 12345, event: 'Numeric User ID' }) ``` -------------------------------- ### Ruby: Ignore ruby version in git Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Configures Git to ignore Ruby version files, preventing unnecessary version-specific files from being tracked. ```Ruby # git: ignore ruby version ``` -------------------------------- ### Ruby: Fix batch clearing causing duplicates Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Resolves an issue where clearing the batch incorrectly led to duplicate events being sent. ```Ruby # Fix batch being cleared and causing duplicates ``` -------------------------------- ### Ruby: Emit logs when messages exceed maximum size Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Logs are now emitted when messages exceed the maximum allowed size, helping to identify and address data formatting issues. ```Ruby # Emit logs # when messages exceed maximum allowed size ``` -------------------------------- ### Ruby: Allow anonymous_id in #alias and #group Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md This fix allows the `anonymous_id` to be used in the `#alias` and `#group` methods, providing more flexibility in user identification and grouping. ```Ruby # Allow `anonymous_id` # in `#alias` and `#group`. ``` -------------------------------- ### Ruby Analytics Request ID for Tracing Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Includes a `requestId` field in all requests for improved tracing and debugging. This allows for easier correlation of requests across different systems. ```Ruby # Assuming analytics client is configured and initialized analytics.track({ user_id: 'user123', event: 'Login', properties: { method: 'email' }, request_id: 'unique-request-id-12345' }) ``` -------------------------------- ### Ruby Analytics Connection Hangup Retries Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Adds retries for connection hangups, enhancing the library's resilience to network interruptions. This ensures that events are more likely to be sent successfully. ```Ruby # The library automatically retries on connection hangups. # This improves the robustness of event delivery. ``` -------------------------------- ### Ruby: Support custom message ID Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Adds support for setting a custom message ID, allowing users to provide their own unique identifiers for events. ```Ruby # Feature: Support setting a custom message ID. ``` -------------------------------- ### Ruby: Modify timestamp for sub-millisecond reporting Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md This update modifies the timestamp to include 3 fractional digits, enabling sub-millisecond reporting precision. This is useful for more granular event tracking. ```Ruby # Modify timestamp to have 3 fractional digits # Update timestamp for sub-millisecond reporting ``` -------------------------------- ### Ruby: Don't clear batch if request failed Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Ensures that the batch is not cleared if a request fails, allowing for potential retries or proper error handling. ```Ruby # fix: don't clear batch if request failed ``` -------------------------------- ### Ruby: Fix log message for stubbed requests Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Addresses an issue with the log message when requests are stubbed, ensuring clarity and correctness in logging output. ```Ruby # Fix log message # for stubbed requests ``` -------------------------------- ### Ruby: Fix oj/rails conflict Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Resolves a conflict between the `oj` gem and Rails, ensuring smoother integration and operation within Rails applications. ```Ruby # Fix oj/rails # conflict ``` -------------------------------- ### Ruby: Add 3 ms to timestamp Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Adds 3 milliseconds to the timestamp, likely for consistency or to meet specific data requirements. ```Ruby # fix: add 3 ms to timestamp ``` -------------------------------- ### Ruby: Prevent 'batch size exceeded' errors Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md This fix prevents 'batch size exceeded' errors by automatically batching items according to their size. This improves the reliability of batch operations. ```Ruby # Prevent 'batch # size exceeded' errors by automatically batching # items according to size ``` -------------------------------- ### Ruby Analytics Alias Call Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Adds the `alias` call functionality, allowing the association of one user ID with another. This is useful for merging user identities. ```Ruby analytics.alias('new_user_id', 'previous_user_id') ``` -------------------------------- ### Ruby Analytics Session ID Removal Source: https://github.com/segmentio/analytics-ruby/blob/master/History.md Removes the `session_id` in favor of a single `user_id` for consistency in user identification. ```Ruby # The library now primarily uses `user_id` for identification. # Ensure your tracking events consistently use `user_id`. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.