utm_tracker 1.0.5 → 1.0.7

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: 4b29d0df59656a7d9f2c1f442d1ae3ef820499aaf92b74ad7da6d4a906987664
4
- data.tar.gz: 106f0530fa2cbec9e0b30f391cb9a43c8d600da5e44be20a2dcda38c26e4435e
3
+ metadata.gz: 02d824f0509faadf27d088d276a97df6e9221b4b5c0f6a6c0f042d94184380c3
4
+ data.tar.gz: 2969b43952b76f07954449baf134220a576edad2484d8f6f022972b67fbfe5b2
5
5
  SHA512:
6
- metadata.gz: eb6d771863180ddc223d5bc591788f2d049c9a3867200f9cd0717982ab7a081e45d257b480f79ba1e01a8d82d40ac106bc0fc93f5443f1dab7941ad1a5559b66
7
- data.tar.gz: f80754d3183e2545bcfefcaad157d1fa13d734db8511436f04075ad07194407786836fa5c806e2de40d6addf373152e0c6a699f10177c4b3ad91aa3cc553fb13
6
+ metadata.gz: e85fe7546e05d2c42c33612bb3ec95af4233041dcd65d0051396c45373cb5d14a551c1a4622dd909b0ecc9e7ec593d28a25001e3073cbac4fdd76dd4320f778f
7
+ data.tar.gz: ecd874ae90e9bb75f648d1e6a29ae10fa3850e0e48f2d1bae940be086f2de929b3deb01da16aaa1b96ea0c2b8c2aeaee71e6142e5d1f12680f9d1d8a8e361c08
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- utm_tracker (1.0.4)
4
+ utm_tracker (1.0.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -2,16 +2,36 @@
2
2
 
3
3
  module UtmTracker
4
4
  module Helper
5
+ UTM_TAGS = [
6
+ "source",
7
+ "campaign",
8
+ "content",
9
+ "medium",
10
+ "term"
11
+ ].freeze
12
+
5
13
  protected
6
14
 
7
15
  def get_utm_data
8
- session[:utm_data] = {
9
- source: params[:utm_source],
10
- medium: params[:utm_medium],
11
- content: params[:utm_content],
12
- campaign: params[:utm_campaign],
13
- term: params[:utm_term],
14
- }
16
+ session[:utm_data] = if utm_data_present?
17
+ {
18
+ source: params[:utm_source],
19
+ campaign: params[:utm_campaign],
20
+ content: params[:utm_content],
21
+ medium: params[:utm_medium],
22
+ term: params[:utm_term],
23
+ }
24
+ else
25
+ {}
26
+ end
27
+ end
28
+
29
+ def utm_data_present?
30
+ UTM_TAGS.each do |tag|
31
+ return true if params["utm_#{tag}".to_sym].present?
32
+ end
33
+
34
+ false
15
35
  end
16
36
  end
17
37
  end
@@ -5,7 +5,7 @@ module UtmTracker
5
5
  attr_accessor :utm_data, :utm
6
6
 
7
7
  def initialize(utm_data, utm = {})
8
- @utm_data = utm_data
8
+ @utm_data = utm_data.transform_keys!(&:to_sym)
9
9
  @utm = utm
10
10
  end
11
11
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UtmTracker
4
- VERSION = "1.0.5"
4
+ VERSION = "1.0.7"
5
5
  end
data/lib/utm_tracker.rb CHANGED
@@ -14,7 +14,7 @@ module UtmTracker
14
14
  end
15
15
 
16
16
  def call
17
- return :nok if utm_matcher.utm_data.nil?
17
+ return :nok if utm_matcher.utm_data.empty?
18
18
 
19
19
  match_utm_tags
20
20
  save_utm_tags_into_database!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utm_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Levashov