gosquared-rails 0.1.0 → 0.2.0

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: 29ecc8597ac248b671b4b05b4fb9c22d834c991a
4
- data.tar.gz: d1265f50e4ac015bd70a0a822b00bfb596ddb433
3
+ metadata.gz: 9c098e6252c312518b8d04d40095902f0307207e
4
+ data.tar.gz: dd0bf76a6f240497f75b368a5637e92bc49eccdb
5
5
  SHA512:
6
- metadata.gz: 0a29e5ad98dca630c1ea21b0d66312b35e573c74b2b89706242d5c089873326674a9d01beaf79c34002586e2480a1470aeb06f5cc42bb2d990c55df4bce3e7aa
7
- data.tar.gz: 2b3e393ef71184910d13b6ccf9e22ac1e0c5e3937421c7eb77e3f5b1da039d3e3d3914c901cf15a2868560c733a2e792091878e67bab962256624bfe0628e8cb
6
+ metadata.gz: 10cee2ddd343842596ee90f905ba109893b2d62e18ed7ae78b9f554b455e8e469b6689b955d26bdd6bcb33c34adf16f7cd6d9ce932e6a3af18364c5daaef8bbd
7
+ data.tar.gz: fb763dedd955851f718a39b02a9c78df69e28758cbdbc581d96ebf7c9e5bb495df3329ed2c811e88fd151ca594fc990c5dcee34543be965e0e9b4de6727df6e0
data/README.md CHANGED
@@ -2,16 +2,17 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/gosquared/gosquared-rails.svg?branch=master)](https://travis-ci.org/gosquared/gosquared-rails)
4
4
 
5
- The GoSquared Rails Gem will allow you to quickly and easily install GoSquared Chat, Anayltics and People in your Rails app.
5
+ The GoSquared Rails Gem will allow you to quickly and easily install GoSquared Live Chat, Anayltics and People in your Rails app.
6
6
 
7
- If you are looking to interact with our Tracking or Reporting API's, you can do so by using our [Ruby Client]
8
- (https://github.com/gosquared/ruby-client)
7
+ **Note, this gem is currently dependent on jQuery which Rails has dropped as a dependency as of Rails v5.1.0. If you are not already using jQuery within your app, you'll have to include it via a gem such as [Jquery-rails](https://github.com/rails/jquery-rails)**
9
8
 
10
- Note, this gem will inject the GoSquared JavaScript snippet as well as GoSquared Identify method in your front end. If you currently have GoSquared JavaScript snippets in place, this can create a conflict.
9
+ If you are looking to interact with our Tracking or Reporting API's, you can do so by using our [Ruby Client](https://github.com/gosquared/ruby-client)
11
10
 
12
- **This is an early beta, please open an issue if you find anything not working, or to leave feedback for improvement. You can also get in touch directly: russell@gosquared.com**
11
+ This gem will inject the GoSquared JavaScript snippet as well as GoSquared Identify method in your front end. If you currently have GoSquared JavaScript snippets in place, this can create a conflict.
13
12
 
14
- ### Install of Analytics and Chat
13
+ Please feel free to open an issue if you find anything not working, or to leave feedback for improvement. You can also get in touch directly: russell@gosquared.com
14
+
15
+ ### Install Analytics and Live Chat
15
16
 
16
17
  With the GoSquared Rails gem you can quickly install GoSquared's tracking code on your app. GoSquared uses a javascript code snippet to track pageviews and optionally load the GoSquared Live Chat widget.
17
18
 
@@ -70,12 +71,12 @@ Whether to track URL querystring parameters, for example /home?my=query&string=t
70
71
 
71
72
  For more details on configuration, you can view the docs here https://www.gosquared.com/docs/api/javascript-tracking-code/configuration#
72
73
 
73
- ### Installation of People
74
+ ### Installation of People (identify users)
74
75
 
75
76
  If you have a user system and would like to track down to an individual user level, you can do so by including the GoSquared Identify Method in your ApplicationController (or any indvidual controller you would like to track.)
76
77
 
77
78
  ```ruby
78
- append_after_filter {|controller| controller.add_gosquared_identify_method your_current_user_object }
79
+ append_after_action {|controller| controller.add_gosquared_identify_method your_current_user_object }
79
80
  ```
80
81
 
81
82
  Then just define the following method in the respective controller and pass in a hash of any properties you'd like to track
@@ -86,7 +87,7 @@ GosquaredRails.configure.custom_properties = {id: current_user_object.id, email:
86
87
  phone: current_user_object.phone_number,
87
88
  monthly_mrr: current_user_object.mrr,
88
89
  role_of_user: current_user_object.role
89
- any_other_property: 'you'd like to track'}
90
+ any_other_property: "you'd like to track"}
90
91
  end
91
92
  ```
92
93
 
@@ -4,7 +4,7 @@ class Injector
4
4
  module Filter
5
5
  extend ActiveSupport::Concern
6
6
  included do
7
- append_after_filter :add_gosquared_script, :if => :html_response?
7
+ append_after_action :add_gosquared_script, :if => :html_response?
8
8
 
9
9
  CLOSING_HEAD_TAG = %r{</head>}
10
10
  CLOSING_BODY_TAG = %r{</body>}
@@ -12,43 +12,48 @@ class Injector
12
12
  def add_gosquared_script
13
13
  response.body = response.body.gsub(CLOSING_HEAD_TAG, "<script>
14
14
 
15
- (function() {
16
- if (window._gs) return;
17
- !function(g,s,q,r,d){r=g[r]=g[r]||function(){(r.q=r.q||[]).push(
18
- arguments)};d=s.createElement(q);q=s.getElementsByTagName(q)[0];
15
+ (function() {
16
+ if (window._gs) return;
17
+ !function(g,s,q,r,d){r=g[r]=g[r]||function(){(r.q=r.q||[]).push(
18
+ arguments)};d=s.createElement(q);q=s.getElementsByTagName(q)[0];
19
19
  d.src='//d1l6p2sc9645hc.cloudfront.net/tracker.js';q.parentNode.
20
20
  insertBefore(d,q)}(window,document,'script','_gs');
21
21
  _gs('#{GosquaredRails.configure.site_token}', false);
22
22
  #{GosquaredRails.configure.config_options}
23
23
 
24
-
25
24
  function track() {
26
25
  _gs('track');
27
26
  }
27
+
28
28
  $(document).on('page:load', track);
29
- $(document).on('turbolinks:load', track);
29
+ $(document).on('turbolinks:load', function(){
30
+ track();
31
+ });
32
+
33
+ let chat;
30
34
 
31
35
  $(document)
32
- .on('turbolinks:before-render', function(event){
33
- var chat = $('[id^=\"gs_\"]');
34
- if (chat.length) {
35
- chat
36
- .detach()
37
- .appendTo(event.originalEvent.data.newBody);
38
- }
36
+ .on('turbolinks:before-cache', function () {
37
+ chat = $('[id=gs]');
38
+ chat.detach();
39
+ })
40
+
41
+ $(document).on('turbolinks:before-render', function(event){
42
+ chat.appendTo(event.originalEvent.data.newBody);
39
43
  })
40
44
  .on('turbolinks:render', function() {
41
45
  try {
42
46
  window.dispatchEvent(new Event('resize'));
43
47
  } catch (e) {}
44
48
  })
45
- })();
49
+ })();
46
50
 
47
- </script>" + "\n </head>"
48
- )
49
- end
51
+ </script>" + "\n </head>"
52
+ )
53
+ end
50
54
 
51
55
  def add_gosquared_identify_method(current_user)
56
+ puts "#{self.class}"
52
57
  if current_user
53
58
  begin
54
59
  gosquared_user_properties
@@ -71,7 +76,7 @@ def populate_script(property_config=PropertyConfig.new)
71
76
  });
72
77
  </script>" + "\n </body>"
73
78
  )
74
- end
79
+ end
75
80
  end
76
81
 
77
82
  def html_response?
@@ -28,7 +28,7 @@ def gosquared_custom_properties
28
28
  end
29
29
 
30
30
  def gosquared_standard_properties
31
- @standard_properties = " { \n "
31
+ @standard_properties= " { \n "
32
32
  @standard_properties_hash.each do |key, value|
33
33
  @standard_properties << "#{key}: '#{value}',\n "
34
34
  end
@@ -2572,3 +2572,15 @@ Processing by AnonymousController#index as HTML
2572
2572
  Completed 200 OK in 4ms (Views: 4.1ms)
2573
2573
  Processing by AnonymousController#new as HTML
2574
2574
  Completed 200 OK in 3ms (Views: 0.1ms)
2575
+ Processing by AnonymousController#index as HTML
2576
+ Rendering html template
2577
+ Rendered html template (0.0ms)
2578
+ Completed 200 OK in 6ms (Views: 6.2ms)
2579
+ Processing by AnonymousController#new as HTML
2580
+ Completed 200 OK in 0ms (Views: 0.2ms)
2581
+ Processing by AnonymousController#index as HTML
2582
+ Rendering html template
2583
+ Rendered html template (0.0ms)
2584
+ Completed 200 OK in 8ms (Views: 7.5ms)
2585
+ Processing by AnonymousController#new as HTML
2586
+ Completed 200 OK in 0ms (Views: 0.1ms)
metadata CHANGED
@@ -1,20 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gosquared-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Vaughan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-04 00:00:00.000000000 Z
11
+ date: 2017-11-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
- GoSquared is your all-in-one software platform for marketing, sales, and support.
15
- This Ruby gem is for quickly installing GoSquared Chat, Analytics and People CRM in your Rails App .
14
+ GoSquared is the Intelligent live chat software designed to engage with visitors at the perfect time.
15
+ This gem is for quickly installing the GoSquared Assistant, GoSquared Real-time Analytics and the People CRM in your Rails App .
16
16
  email:
17
- - russellvaughan@gosquared.com
17
+ - russell@gosquared.com
18
18
  executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
@@ -65,8 +65,8 @@ rubyforge_project:
65
65
  rubygems_version: 2.6.6
66
66
  signing_key:
67
67
  specification_version: 4
68
- summary: Gem for injecting and configuring the GoSquared JavaScript tracking code
69
- and Identify method
68
+ summary: Gem for injecting and configuring the GoSquared Assistant via our JavaScript
69
+ tracking code and Identify method
70
70
  test_files:
71
71
  - spec/configuration_spec.rb
72
72
  - spec/gosquared_generator_spec.rb