staccato 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a69dc443e3cf0db9064a59a292c15d06d1a7cdc8
4
- data.tar.gz: 972bfd289296b857df802c4435d290f0900cc5a4
3
+ metadata.gz: e2d6f5770af7d7943f46b23efc57306323adb0d6
4
+ data.tar.gz: 7ff04c7449bd69f91c7ada112147fe9b2b7a56b3
5
5
  SHA512:
6
- metadata.gz: 0f1415a7a402b8dc46005161f289b1b6e07c59e81362095b300a738d0c0a83fd932623b42966b2457e31ff55daa589a4db04aff2cf17077233238137444ccb10
7
- data.tar.gz: d3f447d6fe02bdc9926ac8c5ecc37c792d3acd965a9e962b6892a95d506c897835446c13f5c92929e80e1c3f9321f6a1cdae8657deaf374eebb9feea37be8a92
6
+ metadata.gz: 3c95ea93ade152acf5db7cd1341c9d75f77b51bcd0eb9d9724608f0d86cda03d73a76cdb3c983473997bae3425a24bb8d37c36b40acc493594582530030ad1f3
7
+ data.tar.gz: 8d86f20f834f4389f5a5ed4a42fd565ff97b2ea9880bee4cf53261c18dd32e30a57c667382281a20329085f6ded983450f77661e53a23f5290c6e6845caf3dea
@@ -1,44 +1,50 @@
1
+ ## Staccato 0.4.4 ##
2
+
3
+ * Adds `Staccato.as_url` to generate a url from a hit, useful for image urls in emails to track opens into GA
4
+
5
+ *Tony Pitale - @tpitale*
6
+
1
7
  ## Staccato 0.4.3 ##
2
8
 
3
9
  * Adds `data_source` as global option
4
10
 
5
- *Matt Thomson <@matt-thomson>*
11
+ *Matt Thomson - @matt-thomson*
6
12
 
7
13
  ## Staccato 0.4.2 ##
8
14
 
9
15
  * Logger adapter for development
10
16
 
11
- *Tony Pitale <@tpitale>*
17
+ *Tony Pitale - @tpitale*
12
18
 
13
19
  ## Staccato 0.4.1 ##
14
20
 
15
21
  * Screenview hit type
16
22
 
17
- *Tony Pitale <@tpitale>*
23
+ *Tony Pitale - @tpitale*
18
24
 
19
25
  ## Staccato 0.4.0 ##
20
26
 
21
27
  * UDP Adapter for use with Staccato::Proxy
22
28
 
23
- *Tony Pitale <@tpitale>*
29
+ *Tony Pitale - @tpitale*
24
30
 
25
31
  ## Staccato 0.3.1 ##
26
32
 
27
33
  * Add customer dimensions and metrics to Product and ProductImpression measurements
28
34
 
29
- *Agustin Cavilliotti <@cavi21>*
35
+ *Agustin Cavilliotti - @cavi21*
30
36
 
31
37
  ## Staccato 0.3.0 ##
32
38
 
33
39
  * HTTP Adapters for HTTP, net/http, and Faraday
34
40
 
35
- *Tony Pitale <@tpitale>*
41
+ *Tony Pitale - @tpitale*
36
42
 
37
43
  ## Staccato 0.2.1 ##
38
44
 
39
45
  * Fix product impression prefix
40
46
 
41
- *Ricky Hanna <@rickyhanna>*
47
+ *Ricky Hanna - @rickyhanna*
42
48
 
43
49
  ## Staccato 0.2.0 ##
44
50
 
@@ -46,7 +52,7 @@
46
52
  * Measurable module for further extension of hits
47
53
  * New global hit options for ecommerce
48
54
 
49
- *Tony Pitale <@tpitale>*
55
+ *Tony Pitale - @tpitale*
50
56
 
51
57
  ## Staccato 0.1.1 ##
52
58
 
@@ -11,12 +11,14 @@ Examples of unacceptable behavior by participants include:
11
11
  * Trolling or insulting/derogatory comments
12
12
  * Public or private harassment
13
13
  * Publishing other's private information, such as physical or electronic addresses, without explicit permission
14
- * Other unethical or unprofessional conduct.
14
+ * Other unethical or unprofessional conduct
15
15
 
16
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
16
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
17
+
18
+ By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
17
19
 
18
20
  This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
19
21
 
20
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
22
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a project maintainer at [INSERT EMAIL ADDRESS]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident.
21
23
 
22
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
24
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.3.0, available at [http://contributor-covenant.org/version/1/3/0/](http://contributor-covenant.org/version/1/3/0/)
data/README.md CHANGED
@@ -534,6 +534,34 @@ If you would prefer to log to a file (default is STDOUT), you can pass in an ins
534
534
 
535
535
  If you would like to format the params hash as something other than `k=v` in your logs, you can pass in anything that responds to `call` and format as a string. The default should be consumable by Splunk and other logging software.
536
536
 
537
+ ## Image URL for Email Open Tracking ##
538
+
539
+ As per [google's docs](https://developers.google.com/analytics/devguides/collection/protocol/v1/email) an `Event` hit type (suggested) may be used to generate an image tag in an email (e.g., as sent by Rails' mailers). This is useful for tracking open stats alongside your other analytics.
540
+
541
+ Things to keep in mind from Google's suggestions:
542
+
543
+ 1. Hit type should be Event
544
+ 2. category should be 'email'
545
+ 3. action should be 'open'
546
+ 4. document path should be the type of email, e.g., 'welcome' or 'invite', etc must start with a '/' and is advised to include some scope such as '/email' to make it easier to find
547
+ 5. document title should be the subject of the email
548
+ 6. set the user id, if it is known; NEVER set the user's email
549
+ 7. system info fields may be included if known
550
+
551
+ To create a url for a hit:
552
+
553
+ ```ruby
554
+ event = tracker.build_event({
555
+ category: 'email',
556
+ action: 'open',
557
+ document_path: '/email/welcome',
558
+ document_title: 'Welcome to Our Website!'
559
+ })
560
+
561
+ # use the image url in your rails template in an image tag
562
+ image_url = Staccato.as_url(event)
563
+ ```
564
+
537
565
  ## Contributing ##
538
566
 
539
567
  1. Fork it
@@ -16,7 +16,7 @@ module Staccato
16
16
  # @param id [String, nil] the id provided by google, i.e., `UA-XXXXXX-Y`
17
17
  # @param client_id [String, Integer, nil] a unique id to track the session of
18
18
  # an individual user
19
- # @params hit_options [Hash] options for use in all hits from this tracker
19
+ # @param hit_options [Hash] options for use in all hits from this tracker
20
20
  # @yield [Staccato::Tracker] the new tracker
21
21
  # @return [Staccato::Tracker] a new tracker is returned
22
22
  def self.tracker(id, client_id = nil, hit_options = {})
@@ -45,6 +45,16 @@ module Staccato
45
45
  require 'staccato/adapter/net_http'
46
46
  Staccato::Adapter::Net::HTTP
47
47
  end
48
+
49
+ # Build a url string from any hit type
50
+ #
51
+ # @param hit [Hit] anything that returns a hash for #params
52
+ # @param uri [URI]
53
+ # @return String
54
+ def self.as_url(hit, uri = Staccato.ga_collection_uri)
55
+ uri.query = URI.encode_www_form(hit.params)
56
+ uri.to_s
57
+ end
48
58
  end
49
59
 
50
60
  require 'staccato/boolean_helpers'
@@ -14,4 +14,4 @@ module Staccato
14
14
  end
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -1,4 +1,4 @@
1
1
  module Staccato
2
2
  # The current Staccato VERSION
3
- VERSION = "0.4.3"
3
+ VERSION = "0.4.4"
4
4
  end
@@ -16,6 +16,29 @@ describe Staccato do
16
16
  expect(tracker.client_id).to eq('a-uuid')
17
17
  end
18
18
 
19
+ context 'given a hit' do
20
+ let(:tracker) {Staccato.tracker('UA-XXXX-Y')}
21
+
22
+ let(:event) {
23
+ tracker.build_event({
24
+ category: 'email',
25
+ action: 'open',
26
+ label: 'welcome',
27
+ value: 1
28
+ })
29
+ }
30
+
31
+ before(:each) do
32
+ SecureRandom.stubs(:uuid).returns("a-uuid")
33
+ end
34
+
35
+ it 'turns a hit into a URL string' do
36
+ url = "http://www.google-analytics.com/collect?v=1&tid=UA-XXXX-Y&cid=a-uuid&t=event&ec=email&ea=open&el=welcome&ev=1"
37
+
38
+ expect(Staccato.as_url(event)).to eq(url)
39
+ end
40
+ end
41
+
19
42
  end
20
43
 
21
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: staccato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Pitale
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-12 00:00:00.000000000 Z
11
+ date: 2015-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler