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 +8 -8
- data/app/controllers/caboose/retargeting_controller.rb +4 -3
- data/app/models/caboose/retargeting_config.rb +17 -8
- data/app/models/caboose/schema.rb +10 -5
- data/app/views/caboose/blocks/_retargeting.html.erb +12 -5
- data/app/views/caboose/retargeting/admin_edit.html.erb +18 -6
- data/lib/caboose/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGZkM2MyZWI1ZWFjOTAwN2I5NGY0OGMxNzcyN2U2MTU1Mzg0OGQ1Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGRmZjI2NzRhYTRkZDIxZGFlNGY1ZjQ3MGZiYWQ3OGUxYzFmZDRhZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWExZjliZDA4MWMwMGVkODY0ZTQ5OGMwMWM0NGJiZmIzOTI3ZjFlNzM1ZTNj
|
10
|
+
NDFiNzU0OGI0NmE1MzhlOWQwYzhhOTY0NGY0Mzc1NTZjYjNjMzZlZmQwMTdk
|
11
|
+
NTUxY2RjNWNmOGMxM2UyY2ZjNGVmYzQ2YzE1MmFjOTY3MjIwZTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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 '
|
31
|
-
when '
|
32
|
-
when 'fb_pixel_id'
|
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
|
-
:
|
9
|
-
:
|
10
|
-
:fb_pixel_id
|
8
|
+
:google_conversion_id,
|
9
|
+
:google_labels_function,
|
10
|
+
:fb_pixel_id,
|
11
|
+
:fb_vars_function
|
11
12
|
|
12
|
-
def
|
13
|
-
return [] if self.
|
14
|
-
return [self.
|
15
|
-
arr = eval(self.
|
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
|
508
|
-
[ :
|
509
|
-
[ :
|
510
|
-
[ :fb_pixel_id
|
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.
|
5
|
+
%><% rc.google_labels(request, page).each do |label| %>
|
6
6
|
<script type='text/javascript'>
|
7
7
|
/* <![CDATA[ */
|
8
|
-
var google_conversion_id = <%= rc.
|
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.
|
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&currency_code=USD&label=<%= raw label %>&guid=ON&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
|
-
|
37
|
+
<% vars = rc.fb_vars(request, page) %>
|
38
|
+
window._fbq.push(['track', 'PixelInitialized', <%= raw Caboose.json(vars) %>]);
|
38
39
|
</script>
|
39
|
-
<noscript
|
40
|
+
<noscript>
|
41
|
+
<%
|
42
|
+
cd = vars.collect{ |k,v| "cd[#{k}]=#{v}" }.join('&')
|
43
|
+
cd = "&#{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 %>&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
|
-
|
9
|
-
<
|
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 %>
|
12
|
+
<p><div id='retargetingconfig_<%= rc.id %>_google_labels_function' ></div></p>
|
12
13
|
<p><code>
|
13
14
|
# This function returns a conversion label string or an array of conversion label strings.<br />
|
14
15
|
# Example 1:<br />
|
@@ -17,6 +18,16 @@ rc = s.retargeting_config
|
|
17
18
|
# 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
|
+
# This function returns an array of key/value strings.<br />
|
27
|
+
# Example:<br />
|
28
|
+
# 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: '
|
42
|
-
{ name: '
|
43
|
-
{ name: 'fb_pixel_id'
|
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
|
});
|
data/lib/caboose/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|