Module: Staccato
- Defined in:
- lib/staccato.rb,
lib/staccato/hit.rb,
lib/staccato/event.rb,
lib/staccato/social.rb,
lib/staccato/timing.rb,
lib/staccato/tracker.rb,
lib/staccato/version.rb,
lib/staccato/pageview.rb,
lib/staccato/exception.rb,
lib/staccato/measurable.rb,
lib/staccato/option_set.rb,
lib/staccato/screenview.rb,
lib/staccato/adapter/udp.rb,
lib/staccato/measurement.rb,
lib/staccato/transaction.rb,
lib/staccato/adapter/http.rb,
lib/staccato/adapter/logger.rb,
lib/staccato/adapter/faraday.rb,
lib/staccato/adapter/net_http.rb,
lib/staccato/adapter/validate.rb,
lib/staccato/transaction_item.rb,
lib/staccato/measurement/product.rb,
lib/staccato/measurement/checkout.rb,
lib/staccato/measurement/promotion.rb,
lib/staccato/measurement/transaction.rb,
lib/staccato/adapter/net_http_via_proxy.rb,
lib/staccato/measurement/checkout_option.rb,
lib/staccato/measurement/impression_list.rb,
lib/staccato/measurement/product_impression.rb
Overview
The ‘Staccato` module namespace
Defined Under Namespace
Modules: Adapter, Hit, Measurable, Measurement Classes: Event, Exception, NoopTracker, OptionSet, Pageview, Screenview, Social, Timing, Tracker, Transaction, TransactionItem
Constant Summary collapse
- VERSION =
The current Staccato VERSION
"0.5.3"
Class Method Summary collapse
-
.as_url(hit, uri = nil) ⇒ Object
Build a url string from any hit type.
-
.build_client_id ⇒ String
Build a new random ‘client_id`.
-
.default_adapter ⇒ Object
The default adapter to use for sending hits.
-
.ga_collection_uri(ssl = false) ⇒ Object
The tracking endpoint we use to submit requests to GA.
-
.tracker(id, client_id = nil, options = {}) {|Staccato::Tracker| ... } ⇒ Staccato::Tracker
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.
Class Method Details
.as_url(hit, uri = nil) ⇒ Object
Build a url string from any hit type
54 55 56 57 58 59 |
# File 'lib/staccato.rb', line 54 def self.as_url(hit, uri = nil) uri ||= hit.tracker.default_uri uri.query = URI.encode_www_form(hit.params) uri.to_s end |
.build_client_id ⇒ String
Build a new random ‘client_id`
33 34 35 |
# File 'lib/staccato.rb', line 33 def self.build_client_id SecureRandom.uuid end |
.default_adapter ⇒ Object
The default adapter to use for sending hits
44 45 46 47 |
# File 'lib/staccato.rb', line 44 def self.default_adapter require 'staccato/adapter/net_http' Staccato::Adapter::Net::HTTP end |
.ga_collection_uri(ssl = false) ⇒ Object
The tracking endpoint we use to submit requests to GA
38 39 40 41 |
# File 'lib/staccato.rb', line 38 def self.ga_collection_uri(ssl = false) url = (ssl ? 'https://' : 'http://') + 'www.google-analytics.com/collect' URI(url) end |
.tracker(id, client_id = nil, options = {}) {|Staccato::Tracker| ... } ⇒ Staccato::Tracker
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
22 23 24 25 26 27 28 |
# File 'lib/staccato.rb', line 22 def self.tracker(id, client_id = nil, = {}) klass = id.nil? ? Staccato::NoopTracker : Staccato::Tracker klass.new(id, client_id, ).tap do |tracker| yield tracker if block_given? end end |