optimizely_server_side 0.0.13 → 0.0.14

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: 7b974d9d401c8dff8321737ee17ee14c05799dc6
4
- data.tar.gz: 8365698fc538b641ae6aa2938921347d7cfd8675
3
+ metadata.gz: 6c1dc5c657f7b38c66727a22cfd4be6a821f1a07
4
+ data.tar.gz: 4278097eedfbc0f0af5764fbd04c57596c82e59a
5
5
  SHA512:
6
- metadata.gz: 85a8e18f9b8b1cf339d90b824c56bcc56e2671d2811b09406cdd0b45b06e83ce24c8105660dbd96d771704632def7e755588446664e68cbb075ee7a2218b9066
7
- data.tar.gz: c8d71fd9d761bb345ff2bd03f5cdae891fea13a3f286c00882824626d23798e03cf3d71d831a83a2eeaaf1c858d8eb7427dfb8ce004b2303d0b40c3a0931d0cf
6
+ metadata.gz: afce5a49010d64e70c03d4fcbb71b27bfb1544220e301f0b9bf018b7ee840a234641445ac8ea685f8d6b05270883c0a3213314309583709f808fad23b5a68a62
7
+ data.tar.gz: a496c71cb65c78df42a45697f24e43465fffa924f0be8ce09e63d84203082f458663f494f80d393d301b53ff37a03bf1052785175b24936825fb6d321015af57
data/Changelog.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.14
2
+
3
+ Added a Omniture tag for tracking in erb
4
+
1
5
  # 0.0.13
2
6
 
3
7
  - Adding support for adding additional attributes via experiments.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- optimizely_server_side (0.0.13)
4
+ optimizely_server_side (0.0.14)
5
5
  activesupport (~> 4.2, >= 4.2.6)
6
6
  optimizely-sdk (~> 0.1.1)
7
7
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/string/output_safety'
4
+
3
5
  module OptimizelyServerSide
4
6
  class Experiment
5
7
 
@@ -9,6 +11,13 @@ module OptimizelyServerSide
9
11
  @variations = []
10
12
  end
11
13
 
14
+ # Hidden omniture tag for HTML tracking
15
+ def omniture_tag(evar: nil)
16
+ if @selected_variation_key
17
+ "<input type='hidden' data-optimizely=#{@experiment_key}:#{@selected_variation_key} data-optimizely-evar=#{evar}></input>".html_safe
18
+ end
19
+ end
20
+
12
21
  # Starts the experiment
13
22
  def start
14
23
  yield(self)
@@ -2,8 +2,8 @@ $:.push File.expand_path("../lib", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'optimizely_server_side'
5
- s.version = '0.0.13'
6
- s.date = '2016-09-11'
5
+ s.version = '0.0.14'
6
+ s.date = '2016-09-13'
7
7
  s.summary = "Optimizely server side. A wrapper on top of optimizely's ruby sdk for easy caching of server side config "
8
8
  s.description = "Optimizely server side. A A/B test wrapper on top of optimizely's ruby sdk for easy caching of server side config and exposing few more utility helpers. Handling of fallbacks and marking primary experiments. "
9
9
  s.authors = ["Ankit Gupta"]
@@ -350,4 +350,26 @@ RSpec.describe OptimizelyServerSide::Experiment do
350
350
  end
351
351
 
352
352
  end
353
+
354
+
355
+ describe '#omniture_tag' do
356
+
357
+ context 'when experiment and selected variation is present' do
358
+
359
+ it 'should have omniture_tag' do
360
+ expect(subject.omniture_tag(evar: '11')).to eq("<input type='hidden' data-optimizely=foo:variation_key_a data-optimizely-evar=11></input>")
361
+ end
362
+
363
+ end
364
+
365
+ context 'when experiment is not having selected variation' do
366
+
367
+ subject { OptimizelyServerSide::Experiment.new('bar',nil) }
368
+
369
+ it 'should have omniture_tag' do
370
+ expect(subject.omniture_tag(evar: '11')).to be_nil
371
+ end
372
+
373
+ end
374
+ end
353
375
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optimizely_server_side
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ankit Gupta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-11 00:00:00.000000000 Z
11
+ date: 2016-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec