plataforma_social 0.0.34 → 0.0.35
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.
- data/lib/plataforma_social/utm.rb +27 -0
- data/lib/plataforma_social/version.rb +1 -1
- metadata +3 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module PlataformaSocial
|
|
2
|
+
class UTM
|
|
3
|
+
def self.add_utm_to_url url, options = {}
|
|
4
|
+
settings = {
|
|
5
|
+
utm_source: 'dito',
|
|
6
|
+
utm_medium: nil,
|
|
7
|
+
utm_campaign: nil
|
|
8
|
+
}.merge options
|
|
9
|
+
|
|
10
|
+
parsedURL = URI.parse(url)
|
|
11
|
+
|
|
12
|
+
params = Rack::Utils.parse_nested_query(parsedURL.query).merge(settings)
|
|
13
|
+
hash = ''
|
|
14
|
+
|
|
15
|
+
if url.index('#')
|
|
16
|
+
splittedHash = url.split('#')
|
|
17
|
+
hash = splittedHash[1]
|
|
18
|
+
url = splittedHash[0]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
url = url.split('?')[0] + '?' + params.to_param
|
|
22
|
+
url = url + '#' + hash if hash.present?
|
|
23
|
+
|
|
24
|
+
url
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: plataforma_social
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.35
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-
|
|
12
|
+
date: 2014-04-15 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: capistrano
|
|
@@ -199,6 +199,7 @@ files:
|
|
|
199
199
|
- lib/plataforma_social/ranking/general.rb
|
|
200
200
|
- lib/plataforma_social/request.rb
|
|
201
201
|
- lib/plataforma_social/support.rb
|
|
202
|
+
- lib/plataforma_social/utm.rb
|
|
202
203
|
- lib/plataforma_social/version.rb
|
|
203
204
|
- plataforma_social.gemspec
|
|
204
205
|
- spec/.DS_Store
|