utm_tracker 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8978d1dec9d65938ffbaba93b4ffb2dbee13cf338806deba734ec735a4ebf50
4
- data.tar.gz: 1134f3fae8e298e142cfb3074490a8d0622b19f6c7be5fc240cea2c6788f3861
3
+ metadata.gz: e6b0ea8d700180ef1c10d945b8580cabfd8aab4ed89316a5a914c59f3b4fd2fa
4
+ data.tar.gz: 3a2e90a56046b068e2da798eb4a41693ee1e6b1b397543a4cea30f19a28de1bd
5
5
  SHA512:
6
- metadata.gz: 5c3e64e33a77058c95bf68bffc68b86ac5c9da61f4a17f189ed6e69cb01a167c2e1c0a2a81acc99d005b038556a63d4e83f303d9202dfc9ced04ba58da9a44e5
7
- data.tar.gz: e5af0c86479ff41ad05f9145e83c2983f5abaafe8555ad31e22faf381602df959dd7a841985d3d8ebbf216cbf01a649e41452146261d98028523c860545fd6bb
6
+ metadata.gz: '09e1230eaaee7395fa4e8197814f7dc4d92286ff472e5cf52cb1cbb2f3cafa917fe276d3ab4d69e4636665ef4b8f352b8a7dbf0fc7e35ab5b192a7f20221a2b4'
7
+ data.tar.gz: e12d148e3e1ef2de009dd8545c03ab6ac0b95b551c10487f54c264237d9e93cb51da255a48492a4dd27ccaeb21d87d2236a16acd4df181b6eac0190da28cad27
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- utm_tracker (1.0.0)
4
+ utm_tracker (1.0.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -4,8 +4,8 @@ This gem allow to save UTM tags into your Rails app. UtmTracker allows you to sa
4
4
 
5
5
  ## Requirements
6
6
 
7
- - Ruby 2.7.1
8
- - Rails 6.1.x
7
+ - Ruby 2.7 / 3.1
8
+ - Rails 6 / 7
9
9
 
10
10
  ## Installation
11
11
 
@@ -17,13 +17,13 @@ gem 'utm_tracker'
17
17
 
18
18
  And then execute:
19
19
 
20
- $ bundle install
20
+ `$ bundle install`
21
21
 
22
22
  ## Usage for Rails
23
23
 
24
24
  1. You need to generate Rails migration and add utm_data into your User model for UTM-tags:
25
25
 
26
- $ rails g migration add_utm_data_to_users utm_data:jsonb
26
+ `$ rails g migration add_utm_data_to_users utm_data:jsonb`
27
27
 
28
28
  and add not null and default modificators into rails migrations:
29
29
  ```ruby
@@ -34,11 +34,11 @@ end
34
34
 
35
35
  and then:
36
36
 
37
- $ rails db:migrate
37
+ `$ rails db:migrate`
38
38
 
39
39
  2. Prepare link into user registration controller:
40
40
 
41
- $ https://example.com?utm_data[source]=google&utm_data[medium]=cpc&utm_data[campaign]=testcampaign&utm[content]={adgroupid}&utm[term]={keyword}
41
+ `$ https://example.com?utm_data[source]=google&utm_data[medium]=cpc&utm_data[campaign]=testcampaign&utm_data[content]={adgroupid}&utm_data[term]={keyword}`
42
42
 
43
43
  3. Add into ApplicationController next helper for save utm_tags into current_user session:
44
44
  ```ruby
@@ -54,10 +54,16 @@ before_action :get_utm_data
54
54
 
55
55
  Add this callback where you plan to receive advertising traffic.
56
56
 
57
- 5. Into user registration controller add UtmTracker client after save user and put user object and session[:utm]:
57
+ 5. Into user registration controller or after_sign_in_path_for method, add UtmTracker client current_user object and session[:utm_data], for_example:
58
58
  ```ruby
59
- @utm = UtmTracker::Client.new(@user, session[:utm])
60
- @utm.call
59
+ def after_sign_in_path_for(resource)
60
+ generate_utm_tags
61
+ something_path
62
+ end
63
+
64
+ def generate_utm_tags
65
+ UtmTracker::Client.new(current_user, session[:utm_data]).call
66
+ end
61
67
  ```
62
68
 
63
69
  ## Development
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UtmTracker
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
data/lib/utm_tracker.rb CHANGED
@@ -14,8 +14,11 @@ module UtmTracker
14
14
  end
15
15
 
16
16
  def call
17
+ return :nok if utm_matcher.utm_data.nil?
18
+
17
19
  match_utm_tags
18
20
  save_utm_tags_into_database!
21
+ :ok
19
22
  end
20
23
 
21
24
  protected
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utm_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Levashov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-28 00:00:00.000000000 Z
11
+ date: 2022-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry