VRFS-736 like us GA support

This commit is contained in:
Jonathan Kolyer 2014-05-11 06:42:20 +00:00
parent cf7522f2e4
commit 91ca1af98b
6 changed files with 37 additions and 14 deletions

View File

@ -49,8 +49,8 @@
<table align="center" width="650" cellpadding="10" bgcolor="#156572" cellspacing="0">
<tr>
<td align="center" valign="top">
<% [:twitter, :facebook, :google].each do |src| %>
<%= link_to(image_tag("http://www.jamkazam.com/assets/content/icon_#{src}.png", :style => "vertical-align:top"), "http://www.jamkazam.com/endorse/@USERID/#{src}") %>&nbsp;
<% [:twitter, :facebook, :google].each do |site| %>
<%= link_to(image_tag("http://www.jamkazam.com/assets/content/icon_#{site}.png", :style => "vertical-align:top"), "http://www.jamkazam.com/endorse/@USERID/#{site}?src=email") %>&nbsp;
<% end %>
</td>
</tr>

View File

@ -79,7 +79,10 @@
band : 'Band',
fan : 'Fan',
recording : 'Recording',
session : 'Session'
session : 'Session',
facebook: 'facebook',
twitter: 'twitter',
google: 'google',
};
var categories = {
@ -271,11 +274,11 @@
context.ga('send', 'event', categories.band, bandAction);
}
function trackJKSocial(category, target) {
function trackJKSocial(category, target, data) {
assertOneOf(category, categories);
assertOneOf(target, jkSocialTargets);
context.ga('send', 'event', category, target);
context.ga('send', 'event', category, target, data);
}

View File

@ -608,7 +608,10 @@
};
context.JK.clientType = function () {
return context.jamClient.IsNativeClient() ? 'client' : 'browser';
if (context.jamClient) {
return context.jamClient.IsNativeClient() ? 'client' : 'browser';
}
return 'browser';
}
/**
* Returns 'MacOSX' if the os appears to be macintosh,

View File

@ -386,7 +386,19 @@ class UsersController < ApplicationController
elsif 'google'==service
url = "https://plus.google.com/share?url=#{url}"
end
redirect_to url
if 'email'==params[:src]
js =<<JS
<script type="text/javascript">
$(function() {
JK.GA.trackJKSocial(JK.GA.Categories.jkLike, '#{service}', 'browser');
window.location = "#{url}";
});
</script>
JS
render :inline => js, :layout => 'landing'
else
redirect_to url
end
end
private

View File

@ -1,10 +1,3 @@
<div style="width:100%; text-align:center">
<div style="margin:0 auto; display: inline-block">
<% [:twitter, :facebook, :google].each do |src| %>
<%= link_to(image_tag("content/icon_#{src}.png", :style => "vertical-align:top"), "/endorse/0/#{src}") %>&nbsp;
<% end %>
</div>
</div>
<!-- start footer -->
<div id="footer">

View File

@ -6,6 +6,12 @@
.clearleft
= link_to "Already have an account?", signin_path, class: "signin", id: "signin"
%div{:style => "width:100%; text-align:center"}
%div{:style => "margin:0 auto; display: inline-block"}
- [:twitter, :facebook, :google].each do |site|
= link_to(image_tag("content/icon_#{site}.png", :style => "vertical-align:top"), "javascript:void(0)", {'data-site' => site, :class => 'like-link'})
= ' '
- content_for :after_black_bar do
- if @jamfest_2014
.jamfest{style: 'top:-70px;position:relative'}
@ -24,6 +30,12 @@
:javascript
$(function () {
window.JK.WelcomePage();
$('.like-link').click(function() {
var like_site = $(this).data('site');
JK.GA.trackJKSocial(JK.GA.Categories.jkLike, like_site, JK.clientType());
window.open("/endorse/0/"+like_site, '_blank');
});
})
- content_for :extra_dialogs do