* olark added VRFS-3853

This commit is contained in:
Seth Call 2016-01-14 04:49:02 -06:00
parent 5773ba6e57
commit e22218b163
11 changed files with 72 additions and 1 deletions

View File

@ -4,6 +4,8 @@ class ApplicationController < ActionController::Base
before_filter :prepare_gon
def prepare_gon
@olark_enabled = false
gon.olark_box_start_hidden = false
gon.prefix = ENV['RAILS_RELATIVE_URL_ROOT'] || '/'
end
end

View File

@ -39,6 +39,8 @@
initializeInfluxDB();
trackNewUser();
trackScreenChanges();
})
$(document).on('JAMKAZAM_READY', function() {
@ -251,6 +253,32 @@
}
}
function trackScreenChanges() {
if (!window.olark) {
return;
}
var activate = ["jamtrack/search", "jamtrack/filter", "shoppingCart", "checkoutPayment", "checkoutOrder", "redeemComplete", "checkoutComplete"]
$(document).on(context.JK.EVENTS.SCREEN_CHANGED, function(e, data) {
var show = false;
if (data.newScreen && activate.indexOf(data.newScreen) > -1) {
show = true;
}
if (show) {
olark('api.box.show');
}
else {
olark('api.box.hide');
}
});
}
function setNavigationStart() {
if(!window.performance || !window.performance.timing) {
try {

View File

@ -618,7 +618,6 @@
// if string passed, see if dialog is showing (even if buried) of a given name
function isDialogShowing() {
if(arguments.length == 1) {
console.log("what?", arguments[0])
// user passed in dialog id
var dialogId = arguments[0];
context._.each(openDialogs, function(dialog) {

View File

@ -105,9 +105,11 @@
}
function afterShow() {
olark('api.box.show');
}
function afterHide() {
olark('api.box.hide');
wizard.onAfterHide();
context.jamClient.FTUESetStatus(true);

View File

@ -9,6 +9,9 @@ class ClientsController < ApplicationController
def index
@olark_enabled = true
gon.olark_box_start_hidden = true
# we want to enforce that /client is always the client view prefix
# this is a side effect of setting root path to '/'; soon we can remove this when we implement the new home page
if request.path == '/'

View File

@ -70,6 +70,8 @@ class LandingsController < ApplicationController
def individual_jamtrack
@olark_enabled = true
@no_landing_tag = true
@landing_tag_play_learn_earn = true
@show_after_black_bar_border = true
@ -185,10 +187,12 @@ class LandingsController < ApplicationController
end
def product_jamblaster
@olark_enabled = true
render 'product_jamblaster', layout: 'web'
end
def product_platform
@olark_enabled = true
@no_landing_tag = true
@landing_tag_play_learn_earn = true
@show_after_black_bar_border = true
@ -196,6 +200,7 @@ class LandingsController < ApplicationController
end
def product_jamtracks
@olark_enabled = true
gon.generic = true
gon.just_previews = true
jam_track = JamTrack.select('plan_code').where(plan_code: Rails.application.config.nominated_jam_track).first

View File

@ -30,6 +30,7 @@ class PopupsController < ApplicationController
end
def jamtrack_player
@olark_enabled = true
@jamtrack_id = params[:jam_track_id]
@websocket = true
gon.jamtrack_id = @jamtrack_id

View File

@ -25,5 +25,6 @@
<%= render "shared/ga" %>
<%= render "shared/recurly" %>
<%= render "shared/google_nocaptcha" %>
<%= render "shared/olark" %>
</body>
</html>

View File

@ -69,6 +69,7 @@
</script>
<%= render "shared/ga" %>
<%= render "shared/olark" %>
<!-- version info: <%= version %> -->
</body>
</html>

View File

@ -162,6 +162,7 @@
<%= render "shared/twttr" %>
<%= render "shared/facebook_sdk" %>
<%= render "shared/google_nocaptcha" %>
<%= render "shared/olark" %>
<!-- version: <%= version %> -->
</body>
</html>

View File

@ -0,0 +1,28 @@
<!-- begin olark code -->
<% if @olark_enabled %>
<script data-cfasync="false" type='text/javascript'>/*<![CDATA[*/window.olark||(function(c){var f=window,d=document,l=f.location.protocol=="https:"?"https:":"http:",z=c.name,r="load";var nt=function(){
f[z]=function(){
(a.s=a.s||[]).push(arguments)};var a=f[z]._={
},q=c.methods.length;while(q--){(function(n){f[z][n]=function(){
f[z]("call",n,arguments)}})(c.methods[q])}a.l=c.loader;a.i=nt;a.p={
0:+new Date};a.P=function(u){
a.p[u]=new Date-a.p[0]};function s(){
a.P(r);f[z](r)}f.addEventListener?f.addEventListener(r,s,false):f.attachEvent("on"+r,s);var ld=function(){function p(hd){
hd="head";return["<",hd,"></",hd,"><",i,' onl' + 'oad="var d=',g,";d.getElementsByTagName('head')[0].",j,"(d.",h,"('script')).",k,"='",l,"//",a.l,"'",'"',"></",i,">"].join("")}var i="body",m=d[i];if(!m){
return setTimeout(ld,100)}a.P(1);var j="appendChild",h="createElement",k="src",n=d[h]("div"),v=n[j](d[h](z)),b=d[h]("iframe"),g="document",e="domain",o;n.style.display="none";m.insertBefore(n,m.firstChild).id=z;b.frameBorder="0";b.id=z+"-loader";if(/MSIE[ ]+6/.test(navigator.userAgent)){
b.src="javascript:false"}b.allowTransparency="true";v[j](b);try{
b.contentWindow[g].open()}catch(w){
c[e]=d[e];o="javascript:var d="+g+".open();d.domain='"+d.domain+"';";b[k]=o+"void(0);"}try{
var t=b.contentWindow[g];t.write(p());t.close()}catch(x){
b[k]=o+'d.write("'+p().replace(/"/g,String.fromCharCode(92)+'"')+'");d.close();'}a.P(2)};ld()};nt()})({
loader: "static.olark.com/jsclient/loader0.js",name:"olark",methods:["configure","extend","declare","identify"]});
/* custom configuration goes here (www.olark.com/documentation) */
olark.identify('1737-108-10-6807');
if (gon.olark_box_start_hidden) {
//olark.configure('box.start_hidden', true);
olark('api.box.hide');
}
//olark.configure('features.attention_grabber', );
/*]]>*/</script><noscript><a href="https://www.olark.com/site/1737-108-10-6807/contact" title="Contact us" target="_blank">Questions? Feedback?</a> powered by <a href="http://www.olark.com?welcome" title="Olark live chat software">Olark live chat software</a></noscript>
<!-- end olark code -->
<% end %>