Sha256: 3c659fd1d8f761f659dfd184ee62d6339f96b8a7ea6822c20d2e1a0bb205cb70
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
require 'ostruct' require 'forwardable' require 'securerandom' require "staccato/version" # The `Staccato` module namespace # # @author Tony Pitale module Staccato # Build a new tracker instance # If the first argument is explicitly `nil`, a `NoopTracker` is returned # which responds to all the same `tracker` methods but does no tracking # # @param id [String, nil] the id provided by google, i.e., `UA-XXXXXX-Y` # @param client_id [String, Integer, nil] a unique id to track the session of # an individual user # @params hit_options [Hash] options for use in all hits from this tracker # @yield [Staccato::Tracker] the new tracker # @return [Staccato::Tracker] a new tracker is returned def self.tracker(id, client_id = nil, hit_options = {}) klass = id.nil? ? Staccato::NoopTracker : Staccato::Tracker klass.new(id, client_id, hit_options).tap do |tracker| yield tracker if block_given? end end # Build a new random `client_id` # # @return [String] a random value suitable for use as a `client_id` def self.build_client_id SecureRandom.uuid end # The tracking endpoint we use to submit requests to GA def self.ga_collection_uri(ssl = false) url = (ssl ? 'https://ssl' : 'http://www') + '.google-analytics.com/collect' URI(url) end end require 'staccato/boolean_helpers' require 'staccato/option_set' require 'staccato/hit' require 'staccato/pageview' require 'staccato/event' require 'staccato/social' require 'staccato/exception' require 'staccato/timing' require 'staccato/transaction' require 'staccato/transaction_item' require 'staccato/tracker' require 'staccato/measurement'
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
staccato-0.3.1 | lib/staccato.rb |
staccato-0.3.0 | lib/staccato.rb |