caboose-cms 0.5.197 → 0.5.198

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmNlZjNhZGU4Y2JlNDJmODYwYjNiODhhYjY2ZGFlYjE3YjM5MjUyYw==
4
+ OGZkM2MyZWI1ZWFjOTAwN2I5NGY0OGMxNzcyN2U2MTU1Mzg0OGQ1Ng==
5
5
  data.tar.gz: !binary |-
6
- MzAzOWQ1NjlmYTE2ODBhYjQ1NGIzNDNmZjBiN2NjZGFhMGJlYzQzOQ==
6
+ OGRmZjI2NzRhYTRkZDIxZGFlNGY1ZjQ3MGZiYWQ3OGUxYzFmZDRhZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzFkNmE2MmQ1NzlmMTBlYWMwNWI3ODNhNTg5YzFmOWE5OTlkODhkNWUxODk0
10
- ZDIxNWE3MDdiN2VhMmJhNDU0MWM2ODA3NmUyMWIyYzJjMmFiNGY5YzMzZWE2
11
- NmE5MGFhOTg4ZmQ0MDZlN2Y4YWJmMGQxMmNiNTRhMTMwNjVhYzY=
9
+ ZWExZjliZDA4MWMwMGVkODY0ZTQ5OGMwMWM0NGJiZmIzOTI3ZjFlNzM1ZTNj
10
+ NDFiNzU0OGI0NmE1MzhlOWQwYzhhOTY0NGY0Mzc1NTZjYjNjMzZlZmQwMTdk
11
+ NTUxY2RjNWNmOGMxM2UyY2ZjNGVmYzQ2YzE1MmFjOTY3MjIwZTQ=
12
12
  data.tar.gz: !binary |-
13
- OWUxNzZmZDY2ZWY5NzA4ZWU1YTQ1NjQyNjEyNTUxMTIxMjg4NGVmMDRlNTA0
14
- ZjI5ZmIwMDBhMTk0ZTYzOWVkMzJhZjdkZWIyNGQzN2JlZTM5MWUwNGJlYTY1
15
- ZWE3YzI0NmFmOWZlMzg2MTY4OGRiYTkzYWVjZGVkODg2N2JmNGU=
13
+ YThmMzA0OGY0MThjNmM1YWM1NjM2MzQ5MGJkZGFjOWZkZTYzYzdiMThmNGVh
14
+ OWY1ZjQwZDllNGYzNjQ1MzZmZGNjZGZiZjg1OWQ5MGZjYWY5OWVlNTdjODY1
15
+ ZWFiOGJhOWNmMjBkYjFlNTc3ZmE2YWI0OTg2NmMwZGI0NjM2M2Q=
@@ -27,9 +27,10 @@ module Caboose
27
27
 
28
28
  params.each do |name,value|
29
29
  case name
30
- when 'conversion_id' then rc.conversion_id = value
31
- when 'labels_function' then rc.labels_function = value
32
- when 'fb_pixel_id' then rc.fb_pixel_id = value
30
+ when 'google_conversion_id' then rc.google_conversion_id = value
31
+ when 'google_labels_function' then rc.google_labels_function = value
32
+ when 'fb_pixel_id' then rc.fb_pixel_id = value
33
+ when 'fb_vars_function' then rc.fb_vars_function = value
33
34
  end
34
35
  end
35
36
 
@@ -5,18 +5,27 @@ module Caboose
5
5
  belongs_to :site
6
6
  attr_accessible :id,
7
7
  :site_id,
8
- :conversion_id,
9
- :labels_function,
10
- :fb_pixel_id
8
+ :google_conversion_id,
9
+ :google_labels_function,
10
+ :fb_pixel_id,
11
+ :fb_vars_function
11
12
 
12
- def labels(request, page)
13
- return [] if self.labels_function.nil? || self.labels_function.strip.length == 0
14
- return [self.labels_function] if self.labels_function.starts_with?('_')
15
- arr = eval(self.labels_function)
13
+ def google_labels(request, page)
14
+ return [] if self.google_labels_function.nil? || self.google_labels_function.strip.length == 0
15
+ return [self.google_labels_function] if self.google_labels_function.starts_with?('_')
16
+ arr = eval(self.google_labels_function)
16
17
  return [] if arr.nil?
17
18
  return [arr] if arr is_a? String
18
19
  return arr
19
- end
20
+ end
21
+
22
+ def fb_vars(request, page)
23
+ return nil if self.fb_vars_function.nil? || self.fb_vars_function.strip.length == 0
24
+ arr = eval(self.fb_vars_function)
25
+ return [] if arr.nil?
26
+ return [arr] if arr is_a? String
27
+ return arr
28
+ end
20
29
 
21
30
  end
22
31
  end
@@ -18,7 +18,11 @@ class Caboose::Schema < Caboose::Utilities::Schema
18
18
  #Caboose::Field => { :page_block_id => :block_id,
19
19
  # :page_block_field_id => :field_type_id },
20
20
  #Caboose::FieldType => { :page_block_type_id => :block_type_id },
21
- Caboose::Block => { :page_block_type_id => :block_type_id }
21
+ Caboose::Block => { :page_block_type_id => :block_type_id },
22
+ Caboose::RetargetingConfig => {
23
+ :conversion_id => :google_conversion_id,
24
+ :labels_function => :google_labels_function
25
+ }
22
26
  }
23
27
  end
24
28
 
@@ -504,10 +508,11 @@ class Caboose::Schema < Caboose::Utilities::Schema
504
508
  [ :variant_id , :integer ]
505
509
  ],
506
510
  Caboose::RetargetingConfig => [
507
- [ :site_id , :integer ],
508
- [ :conversion_id , :string ],
509
- [ :labels_function , :text ],
510
- [ :fb_pixel_id , :string ]
511
+ [ :site_id , :integer ],
512
+ [ :google_conversion_id , :string ],
513
+ [ :google_labels_function , :text ],
514
+ [ :fb_pixel_id , :string ],
515
+ [ :fb_vars_function , :text ]
511
516
  ],
512
517
  Caboose::Review => [
513
518
  [ :product_id , :integer ],
@@ -2,10 +2,10 @@
2
2
  <% rc = site.retargeting_config %>
3
3
  <%
4
4
  # Google audiences
5
- %><% rc.labels(request, page).each do |label| %>
5
+ %><% rc.google_labels(request, page).each do |label| %>
6
6
  <script type='text/javascript'>
7
7
  /* <![CDATA[ */
8
- var google_conversion_id = <%= rc.conversion_id %>;
8
+ var google_conversion_id = <%= rc.google_conversion_id %>;
9
9
  var google_conversion_label = "<%= raw label %>";
10
10
  var google_custom_params = window.google_tag_params;
11
11
  var google_remarketing_only = true;
@@ -14,7 +14,7 @@
14
14
  <script type='text/javascript' src='//www.googleadservices.com/pagead/conversion.js'></script>
15
15
  <noscript>
16
16
  <div style='display:inline;'>
17
- <img height='1' width='1' style='border-style:none;' alt='' src='//googleads.g.doubleclick.net/pagead/viewthroughconversion/<%= raw rc.conversion_id %>/?value=1.00&amp;currency_code=USD&amp;label=<%= raw label %>&amp;guid=ON&amp;script=0'/>
17
+ <img height='1' width='1' style='border-style:none;' alt='' src='//googleads.g.doubleclick.net/pagead/viewthroughconversion/<%= raw rc.google_conversion_id %>/?value=1.00&amp;currency_code=USD&amp;label=<%= raw label %>&amp;guid=ON&amp;script=0'/>
18
18
  </div>
19
19
  </noscript>
20
20
  <% end %>
@@ -34,8 +34,15 @@
34
34
  _fbq.push(['addPixelId', '<%= raw rc.fb_pixel_id %>']);
35
35
  })();
36
36
  window._fbq = window._fbq || [];
37
- window._fbq.push(['track', 'PixelInitialized', {}]);
37
+ <% vars = rc.fb_vars(request, page) %>
38
+ window._fbq.push(['track', 'PixelInitialized', <%= raw Caboose.json(vars) %>]);
38
39
  </script>
39
- <noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id=<%= raw rc.fb_pixel_id %>&amp;ev=PixelInitialized" /></noscript>
40
+ <noscript>
41
+ <%
42
+ cd = vars.collect{ |k,v| "cd[#{k}]=#{v}" }.join('&amp;')
43
+ cd = "&amp;#{cd}" if vars.count > 0
44
+ %>
45
+ <img height="1" width="1" border="0" alt="" style="display:none" src="https://www.facebook.com/tr?id=<%= raw rc.fb_pixel_id %>&amp;ev=PixelInitialized<%= raw cd %>" />
46
+ </noscript>
40
47
  <% end %>
41
48
  <% end %>
@@ -5,10 +5,11 @@ rc = s.retargeting_config
5
5
  <%= render :partial => 'caboose/sites/admin_header' %>
6
6
 
7
7
  <p><div id='site_<%= s.id %>_use_retargeting' ></div></p>
8
- <p><div id='retargetingconfig_<%= rc.id %>_fb_pixel_id' ></div></p>
9
- <p><div id='retargetingconfig_<%= rc.id %>_conversion_id' ></div></p>
8
+
9
+ <h2>Google</h2>
10
+ <p><div id='retargetingconfig_<%= rc.id %>_google_conversion_id' ></div></p>
10
11
  <p><code>def google_conversion_labels_function(request, page) {</code></p>
11
- <p><div id='retargetingconfig_<%= rc.id %>_labels_function' ></div></p>
12
+ <p><div id='retargetingconfig_<%= rc.id %>_google_labels_function' ></div></p>
12
13
  <p><code>
13
14
  &nbsp;&nbsp;# This function returns a conversion label string or an array of conversion label strings.<br />
14
15
  &nbsp;&nbsp;# Example 1:<br />
@@ -17,6 +18,16 @@ rc = s.retargeting_config
17
18
  &nbsp;&nbsp;# return ["abc123", "xyz456"]<br />
18
19
  }</code></p>
19
20
 
21
+ <h2>Facebook</h2>
22
+ <p><div id='retargetingconfig_<%= rc.id %>_fb_pixel_id' ></div></p>
23
+ <p><code>def facebook_custom_data_function(request, page) {</code></p>
24
+ <p><div id='retargetingconfig_<%= rc.id %>_fb_vars_function' ></div></p>
25
+ <p><code>
26
+ &nbsp;&nbsp;# This function returns an array of key/value strings.<br />
27
+ &nbsp;&nbsp;# Example:<br />
28
+ &nbsp;&nbsp;# return { 'segment' => 'General' }<br />
29
+ }</code></p>
30
+
20
31
  <%= render :partial => 'caboose/sites/admin_footer' %>
21
32
 
22
33
  <% content_for :caboose_js do %>
@@ -38,9 +49,10 @@ $(document).ready(function() {
38
49
  update_url: "/admin/sites/<%= @site.id %>/retargeting",
39
50
  authenticity_token: '<%= form_authenticity_token %>',
40
51
  attributes: [
41
- { name: 'conversion_id' , nice_name: 'Google Conversion ID' , type: 'text' , value: <%= raw Caboose.json(rc.conversion_id ) %>, width: 600 },
42
- { name: 'labels_function' , nice_name: 'Conversion Labels Function' , type: 'textarea' , value: <%= raw Caboose.json(rc.labels_function ) %>, width: 600, height: 75, fixed_placeholder: false },
43
- { name: 'fb_pixel_id' , nice_name: 'Facebook Pixel ID' , type: 'text' , value: <%= raw Caboose.json(rc.fb_pixel_id ) %>, width: 600 }
52
+ { name: 'google_conversion_id' , nice_name: 'Google Conversion ID' , type: 'text' , value: <%= raw Caboose.json(rc.google_conversion_id ) %>, width: 600 },
53
+ { name: 'google_labels_function' , nice_name: 'Conversion Labels Function' , type: 'textarea' , value: <%= raw Caboose.json(rc.google_labels_function ) %>, width: 600, height: 75, fixed_placeholder: false },
54
+ { name: 'fb_pixel_id' , nice_name: 'Facebook Pixel ID' , type: 'text' , value: <%= raw Caboose.json(rc.fb_pixel_id ) %>, width: 600 },
55
+ { name: 'fb_vars_function' , nice_name: 'Facebook Custom Data Function' , type: 'textarea' , value: <%= raw Caboose.json(rc.fb_vars_function ) %>, width: 600, height: 75, fixed_placeholder: false }
44
56
  ]
45
57
  });
46
58
  });
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.197'
2
+ VERSION = '0.5.198'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.197
4
+ version: 0.5.198
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-10 00:00:00.000000000 Z
11
+ date: 2015-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg