caboose-cms 0.5.195 → 0.5.196
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 +8 -8
- data/app/controllers/caboose/retargeting_controller.rb +3 -2
- data/app/models/caboose/retargeting_config.rb +15 -3
- data/app/models/caboose/schema.rb +2 -1
- data/app/views/caboose/blocks/_retargeting.html.erb +25 -3
- data/app/views/caboose/retargeting/admin_edit.html.erb +25 -4
- 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
|
+
ZjM1ZjMxZmM0YzU4MjdmNDIyY2RhZWZkNjgyODIyMjRkZGI3ZmExYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDA3YjM5NDk0Y2E2ODlhZDM0YjQyMzMwMmZlMDJlNDA0NzgzYWIxYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGEzN2I1Nzc0YWU4NWM4YWY0OTMwMTQ2NWZiMGY3ZDFkNmI4MWY5ZjdhYWNj
|
10
|
+
OWEzYThjMGM0OGZiYmE5MDEzOTAxMDg3N2QzYWI4Yjg3YjIxN2RkNTA5N2Yx
|
11
|
+
NGM0MmJkM2U4OTExN2QxM2M1YWJlNzMyN2EwMWQwNTU1NzkxMjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzE2Y2YyOWNiMTIwNDIzNmExNDhmMjNiNjE4NTBmOWJjZjFmZjU0NDcyMjlh
|
14
|
+
YTFkNDNjNmFhM2NlNjFkOWQ0MGNmZjZiM2YyNTYyODU1M2U0NTMyMmE4YjNi
|
15
|
+
MjM2MzFjNTg3MWE1MTc5ZTY2YWZhYWQ3ODNkYmQzNWNkY2JiYTg=
|
@@ -27,8 +27,9 @@ module Caboose
|
|
27
27
|
|
28
28
|
params.each do |name,value|
|
29
29
|
case name
|
30
|
-
when 'conversion_id'
|
31
|
-
when 'labels_function'
|
30
|
+
when 'conversion_id' then rc.conversion_id = value
|
31
|
+
when 'labels_function' then rc.labels_function = value
|
32
|
+
when 'fb_pixels_function' then rc.fb_pixels_function = value
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
@@ -6,13 +6,25 @@ module Caboose
|
|
6
6
|
attr_accessible :id,
|
7
7
|
:site_id,
|
8
8
|
:conversion_id,
|
9
|
-
:labels_function
|
9
|
+
:labels_function,
|
10
|
+
:fb_pixels_function
|
10
11
|
|
11
|
-
def labels(request, page)
|
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)
|
16
|
+
return [] if arr.nil?
|
13
17
|
return [arr] if arr is_a? String
|
14
18
|
return arr
|
15
19
|
end
|
16
20
|
|
21
|
+
def fb_pixels(request, page)
|
22
|
+
return [] if self.fb_pixels_function.nil? || self.fb_pixels_function.strip.length == 0
|
23
|
+
arr = eval(self.fb_pixels_function)
|
24
|
+
return [] if arr.nil?
|
25
|
+
return [arr] if arr.is_a?(String) || arr.is_a?(Integer)
|
26
|
+
return arr
|
27
|
+
end
|
28
|
+
|
17
29
|
end
|
18
30
|
end
|
@@ -505,7 +505,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
505
505
|
Caboose::RetargetingConfig => [
|
506
506
|
[ :site_id , :integer ],
|
507
507
|
[ :conversion_id , :string ],
|
508
|
-
[ :labels_function , :text ]
|
508
|
+
[ :labels_function , :text ],
|
509
|
+
[ :fb_pixels_function , :text ]
|
509
510
|
],
|
510
511
|
Caboose::Review => [
|
511
512
|
[ :product_id , :integer ],
|
@@ -1,6 +1,8 @@
|
|
1
|
-
<% if site.use_retargeting %>
|
2
|
-
<% rc = site.retargeting_config %>
|
3
|
-
<%
|
1
|
+
<% if site.use_retargeting %>
|
2
|
+
<% rc = site.retargeting_config %>
|
3
|
+
<%
|
4
|
+
# Google audiences
|
5
|
+
%><% rc.labels(request, page).each do |label| %>
|
4
6
|
<script type='text/javascript'>
|
5
7
|
/* <![CDATA[ */
|
6
8
|
var google_conversion_id = <%= rc.conversion_id %>;
|
@@ -16,4 +18,24 @@
|
|
16
18
|
</div>
|
17
19
|
</noscript>
|
18
20
|
<% end %>
|
21
|
+
<%
|
22
|
+
# Facebook audiences
|
23
|
+
%><% rc.fb_pixels(request, page).each do |pixel_id| %>
|
24
|
+
<script>(function() {
|
25
|
+
var _fbq = window._fbq || (window._fbq = []);
|
26
|
+
if (!_fbq.loaded) {
|
27
|
+
var fbds = document.createElement('script');
|
28
|
+
fbds.async = true;
|
29
|
+
fbds.src = '//connect.facebook.net/en_US/fbds.js';
|
30
|
+
var s = document.getElementsByTagName('script')[0];
|
31
|
+
s.parentNode.insertBefore(fbds, s);
|
32
|
+
_fbq.loaded = true;
|
33
|
+
}
|
34
|
+
_fbq.push(['addPixelId', '<%= raw pixel_id %>']);
|
35
|
+
})();
|
36
|
+
window._fbq = window._fbq || [];
|
37
|
+
window._fbq.push(['track', 'PixelInitialized', {}]);
|
38
|
+
</script>
|
39
|
+
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id=<%= raw pixel_id %>&ev=PixelInitialized" /></noscript>
|
40
|
+
<% end %>
|
19
41
|
<% end %>
|
@@ -5,11 +5,31 @@ 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
|
+
<h2>Google Audiences</h2>
|
8
10
|
<p><div id='retargetingconfig_<%= rc.id %>_conversion_id' ></div></p>
|
9
|
-
<
|
11
|
+
<h3>Conversion Labels</h3>
|
10
12
|
<p><code>def conversion_labels_function(request, page) {</code></p>
|
11
13
|
<p><div id='retargetingconfig_<%= rc.id %>_labels_function' ></div></p>
|
12
|
-
<p><code
|
14
|
+
<p><code>
|
15
|
+
# This function returns a conversion label string or an array of conversion label strings.<br />
|
16
|
+
# Example 1:<br />
|
17
|
+
# return "abc123"<br />
|
18
|
+
# Example 2: <br />
|
19
|
+
# return ["abc123", "xyz456"]<br />
|
20
|
+
}</code></p>
|
21
|
+
|
22
|
+
<h2>Facebook Pixel IDs</h2>
|
23
|
+
<p><code>def facebook_pixel_ids(request, page) {</code></p>
|
24
|
+
<p><div id='retargetingconfig_<%= rc.id %>_fb_pixels_function' ></div></p>
|
25
|
+
<p><code>
|
26
|
+
# This function returns a pixel ID string or an array of pixel ID strings.<br />
|
27
|
+
# Example 1:<br />
|
28
|
+
# return "abc123"<br />
|
29
|
+
# Example 2: <br />
|
30
|
+
# return ["abc123", "xyz456"]<br />
|
31
|
+
# This function returns an array of conversion labels<br />
|
32
|
+
}</code></p>
|
13
33
|
|
14
34
|
<%= render :partial => 'caboose/sites/admin_footer' %>
|
15
35
|
|
@@ -32,8 +52,9 @@ $(document).ready(function() {
|
|
32
52
|
update_url: "/admin/sites/<%= @site.id %>/retargeting",
|
33
53
|
authenticity_token: '<%= form_authenticity_token %>',
|
34
54
|
attributes: [
|
35
|
-
{ name: 'conversion_id'
|
36
|
-
{ name: 'labels_function'
|
55
|
+
{ name: 'conversion_id' , nice_name: 'Conversion ID' , type: 'text' , value: <%= raw Caboose.json(rc.conversion_id ) %>, width: 600 },
|
56
|
+
{ name: 'labels_function' , nice_name: 'Conversion Labels Function' , type: 'textarea' , value: <%= raw Caboose.json(rc.labels_function ) %>, width: 600, height: 75, fixed_placeholder: false },
|
57
|
+
{ name: 'fb_pixels_function' , nice_name: 'Facebook Pixel IDs Function' , type: 'textarea' , value: <%= raw Caboose.json(rc.fb_pixels_function ) %>, width: 600, height: 75, fixed_placeholder: false }
|
37
58
|
]
|
38
59
|
});
|
39
60
|
});
|
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.196
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|