facebook_app 0.0.3
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.
- data/Gemfile +4 -0
- data/Gemfile.lock +158 -0
- data/README.textile +52 -0
- data/Rakefile +1 -0
- data/app/assets/images/shared/ajax-loader.gif +0 -0
- data/app/assets/images/single_pixel.png +0 -0
- data/app/assets/javascripts/facebook_app.js +9 -0
- data/app/assets/javascripts/pages.coffee.erb +18 -0
- data/app/assets/stylesheets/admin.sass +13 -0
- data/app/assets/stylesheets/configurables.sass +11 -0
- data/app/assets/stylesheets/facebook_app.css +9 -0
- data/app/assets/stylesheets/layout.css.scss +280 -0
- data/app/assets/stylesheets/yui-3.4.1.css +7 -0
- data/app/controllers/facebook_app/achievements_controller.rb +21 -0
- data/app/controllers/facebook_app/admin_controller.rb +42 -0
- data/app/controllers/facebook_app/external_trackings_controller.rb +21 -0
- data/app/controllers/facebook_app/facebook_app_controller.rb +59 -0
- data/app/controllers/facebook_app/oauth_controller.rb +46 -0
- data/app/controllers/facebook_app/pages_controller.rb +14 -0
- data/app/helpers/facebook_app/application_helper.rb +55 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/facebook_app/conversion.rb +50 -0
- data/app/models/facebook_app/conversion_summary.rb +58 -0
- data/app/models/facebook_app/facebook_credentials.rb +56 -0
- data/app/models/facebook_app/infographic_server_communicator.rb +21 -0
- data/app/views/facebook_app/achievements/show.html.slim +12 -0
- data/app/views/facebook_app/admin/_conversion_stage.html.slim +5 -0
- data/app/views/facebook_app/admin/_spamalytics.html.slim +16 -0
- data/app/views/facebook_app/admin/new_fb_credentials.html.slim +10 -0
- data/app/views/facebook_app/admin/show.html.slim +28 -0
- data/app/views/facebook_app/external_trackings/test.html.slim +3 -0
- data/app/views/facebook_app/pages/privacy_policy.html.slim +49 -0
- data/app/views/facebook_app/pages/terms_of_service.html.slim +49 -0
- data/app/views/layouts/facebook_app.html.slim +17 -0
- data/config/routes.rb +31 -0
- data/db/migrate/20111024214949_add_facebook_app.rb +29 -0
- data/facebook_app.gemspec +33 -0
- data/lib/facebook_app/engine.rb +15 -0
- data/lib/facebook_app/recipes.rb +39 -0
- data/lib/facebook_app/version.rb +3 -0
- data/lib/facebook_app.rb +15 -0
- data/lib/generators/facebook_app/install_generator.rb +19 -0
- data/lib/generators/facebook_app/templates/configurable.yml +79 -0
- data/lib/generators/facebook_app/templates/delayed_job +5 -0
- data/lib/generators/facebook_app/templates/seeds.rb +7 -0
- data/script/infographic.py +180 -0
- metadata +180 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module FacebookApp
|
|
2
|
+
class FacebookAppController < ActionController::Base
|
|
3
|
+
helper FacebookApp::ApplicationHelper
|
|
4
|
+
|
|
5
|
+
protect_from_forgery
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def require_awards_set_by_admin
|
|
10
|
+
if (Configurable["award_name_1"] == "default")
|
|
11
|
+
flash[:notice] = "You haven't set any awards yet. Do so now."
|
|
12
|
+
redirect_to facebook_app.admin_path
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def didnt_grant_extended_permissions
|
|
17
|
+
load_graph
|
|
18
|
+
!@graph.get_connections("me", "permissions")[0]["publish_stream"]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def ensure_logged_in
|
|
22
|
+
needs_login = ! (session[:at] && session[:oauth_expiry] && session[:oauth_expiry].to_i > Time.now.utc.to_i )
|
|
23
|
+
if needs_login
|
|
24
|
+
# tracking is only relevant for users who will log in
|
|
25
|
+
begin_tracking
|
|
26
|
+
session[:oauth_expiry] = nil
|
|
27
|
+
redirect_to oauth_code_link
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def begin_tracking
|
|
32
|
+
# only track the first time they visit
|
|
33
|
+
unless cookies[:conversion_id]
|
|
34
|
+
@conversion = Conversion.create(:marketing_mode =>params[:marketing_mode])
|
|
35
|
+
cookies[:conversion_id] = @conversion.id
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# loads the graph from the users point of view
|
|
40
|
+
def load_graph
|
|
41
|
+
@graph ||= Koala::Facebook::API.new(session[:at])
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# special login for accessing graph as the app
|
|
45
|
+
def login_as_app
|
|
46
|
+
app_token = authenticator.get_app_access_token
|
|
47
|
+
@app_graph = Koala::Facebook::API.new(app_token)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def oauth_code_link
|
|
51
|
+
authenticator.url_for_oauth_code(:permissions => Configurable["facebook_permissions"])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def authenticator
|
|
55
|
+
@authenticator ||= Koala::Facebook::OAuth.new(FacebookCredentials.app_id, FacebookCredentials.secret, facebook_app.oauth_callback_url(:marketing_mode => params[:marketing_type]))
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module FacebookApp
|
|
2
|
+
class OauthController < FacebookAppController
|
|
3
|
+
|
|
4
|
+
def denied
|
|
5
|
+
Conversion.track(cookies[:conversion_id], :deny_permissions)
|
|
6
|
+
client_side_redirect= %Q{
|
|
7
|
+
<script>
|
|
8
|
+
top.location="#{identified_tracking_link}";
|
|
9
|
+
</script>
|
|
10
|
+
}.html_safe
|
|
11
|
+
render :inline => client_side_redirect
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# this is the callback URL. It should handle both the case
|
|
15
|
+
# where the user authenticates us and the case when they don't
|
|
16
|
+
def create
|
|
17
|
+
if params["error_reason"] == "user_denied"
|
|
18
|
+
redirect_to facebook_app.denied_path
|
|
19
|
+
else
|
|
20
|
+
access_token_info = authenticator.get_access_token_info(params[:code])
|
|
21
|
+
session[:at] = access_token_info["access_token"]
|
|
22
|
+
session[:oauth_expiry] = token_expiration_time
|
|
23
|
+
|
|
24
|
+
if didnt_grant_extended_permissions
|
|
25
|
+
Conversion.track(cookies[:conversion_id], :deny_extended_permissions)
|
|
26
|
+
session[:at] = nil
|
|
27
|
+
redirect_to facebook_app.identified_path
|
|
28
|
+
else
|
|
29
|
+
Conversion.track(cookies[:conversion_id], :accept_permissions)
|
|
30
|
+
redirect_to root_url
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def token_expiration_time
|
|
38
|
+
(Time.now.utc + 30.minutes).to_i
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def identified_tracking_link
|
|
42
|
+
Configurable[:identified_tracking_link]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module FacebookApp
|
|
2
|
+
module ApplicationHelper
|
|
3
|
+
|
|
4
|
+
#assumes you have called ApplicationController#login_with_facebook
|
|
5
|
+
#
|
|
6
|
+
#Set the page title from view file
|
|
7
|
+
def title=(title)
|
|
8
|
+
content_for(:title, title.to_s)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def hypenate(words)
|
|
12
|
+
words.downcase.gsub(' ', "-")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def current_url
|
|
16
|
+
request.url
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def current_domain
|
|
20
|
+
current_url.split("/").first(3).join("/")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def image_url(image_name)
|
|
24
|
+
current_domain + image_path(image_name)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
#Show the page title in your layouts
|
|
28
|
+
def title
|
|
29
|
+
given_title = content_for(:title)
|
|
30
|
+
given_title.empty? ? sitename : given_title + " | " + sitename
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
#Set the seo_desc from view file
|
|
34
|
+
def seo_desc=(seo_desc)
|
|
35
|
+
content_for(:seo_desc, seo_desc.to_s)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
#Show the page seo_desc in your layouts
|
|
39
|
+
def seo_desc
|
|
40
|
+
given_seo_desc = content_for(:seo_desc)
|
|
41
|
+
given_seo_desc.empty? ? "#{sitename} is just what you need" : given_seo_desc
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def sitename
|
|
45
|
+
Configurable[:app_name]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def google_analytics
|
|
49
|
+
content_tag :script do
|
|
50
|
+
%{ var _gaq = _gaq || []; _gaq.push(['_setAccount', '#{Configurable[:analytics_code]}']); _gaq.push(['_trackPageview']); (function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);})(); }
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
end
|
|
File without changes
|
data/app/models/.gitkeep
ADDED
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module FacebookApp
|
|
2
|
+
class Conversion < ActiveRecord::Base
|
|
3
|
+
|
|
4
|
+
set_table_name "facebook_app_conversions"
|
|
5
|
+
state_machine :state, :initial => :permissions_dialogue do
|
|
6
|
+
|
|
7
|
+
# after_transition :on => :accept_permissions, :do => :record_permissions_acceptance
|
|
8
|
+
# after_transition :on => :deny_permissions, :do => :record_permissions_denial
|
|
9
|
+
# after_transition :on => :generated_infographic, :do => :record_infographic_generation
|
|
10
|
+
#
|
|
11
|
+
|
|
12
|
+
event :deny_permissions do
|
|
13
|
+
transition :permissions_dialogue => :denied_permissions
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
event :deny_extended_permissions do
|
|
17
|
+
transition :permissions_dialogue => :denied_extended_permissions
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
event :accept_permissions do
|
|
21
|
+
transition :permissions_dialogue => :installed
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
event :generate_infographic do
|
|
25
|
+
transition [:accept_permissions, :installed] => :generated_infographic
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
event :sign_up_on_identified do
|
|
29
|
+
transition any => :signed_up_for_identified
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.find_or_create(conversion_id)
|
|
34
|
+
find(conversion_id)
|
|
35
|
+
rescue
|
|
36
|
+
create
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.track(conversion_id, conversion_state=nil)
|
|
40
|
+
conversion = find_or_create(conversion_id)
|
|
41
|
+
conversion.send(conversion_state) unless conversion_state.nil?
|
|
42
|
+
conversion
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def recent?
|
|
46
|
+
created_at < 6.hours.ago
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module FacebookApp
|
|
2
|
+
class ConversionSummary
|
|
3
|
+
|
|
4
|
+
def virality_coefficient(state)
|
|
5
|
+
(send(state, :viral).to_i.fdiv(send(state, :advertising).to_i)*100).to_s
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def permissions_state_count(marketing_mode)
|
|
9
|
+
state_count(:permissions_dialogue, marketing_mode).to_s
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def installed_state_count(marketing_mode)
|
|
13
|
+
state_count(:installed, marketing_mode).to_s
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def denied_state_count(marketing_mode)
|
|
17
|
+
state_count(:denied_permissions, marketing_mode).to_s
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def denied_extended_state_count(marketing_mode)
|
|
21
|
+
state_count(:denied_extended_permissions, marketing_mode).to_s
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def infographic_state_count(marketing_mode)
|
|
25
|
+
state_count(:generated_infographic, marketing_mode).to_s
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def signed_up_identified_state_count(marketing_mode)
|
|
29
|
+
state_count(:signed_up_identified, marketing_mode).to_s
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def state_count(state_to_calculate, marketing_mode)
|
|
33
|
+
case marketing_mode
|
|
34
|
+
when :all
|
|
35
|
+
Conversion.count(:conditions => state_fragment(state_to_calculate))
|
|
36
|
+
when nil
|
|
37
|
+
Conversion.count(:conditions => "marketing_mode is null AND #{state_fragment(state_to_calculate)}")
|
|
38
|
+
else
|
|
39
|
+
Conversion.count(:conditions => "marketing_mode='#{marketing_mode.to_s}' AND #{state_fragment(state_to_calculate)}")
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# reasoning behind this method is that stats are accumulative.
|
|
44
|
+
# somethign in the infographic state had previously been installed
|
|
45
|
+
# as per state machine
|
|
46
|
+
def state_fragment(state_to_calculate)
|
|
47
|
+
case state_to_calculate
|
|
48
|
+
when :permissions_dialogue
|
|
49
|
+
"state in ('generated_infographic', 'denied_permissions', 'denied_extended_permissions', 'installed', 'signed_up_for_identified', 'permissions_dialogue')"
|
|
50
|
+
when :installed
|
|
51
|
+
"state in ('installed', 'generated_infographic', 'signed_up_for_identified')"
|
|
52
|
+
else
|
|
53
|
+
"state = '#{state_to_calculate.to_s}'"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module FacebookApp
|
|
2
|
+
class FacebookCredentials < ActiveRecord::Base
|
|
3
|
+
attr_accessible :app_id, :secret, :app_url, :development, :password, :email
|
|
4
|
+
validates_presence_of :app_id, :secret, :app_url
|
|
5
|
+
|
|
6
|
+
scope :last_production_config, where(:development => false).order("id desc").limit(1)
|
|
7
|
+
scope :last_development_config, where(:development => true).order("id desc").limit(1)
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
|
|
11
|
+
def seed_initial_credentials
|
|
12
|
+
create(:development => true, :app_id => "225198020866871", :secret => "c13ca68717af076f6832f4d38a6da48a", :app_url => "http://apps.facebook.com/the-better-frienddev", :email => "jack.kinsella@gmail.com", :password => "notteling" )
|
|
13
|
+
create(:development => false, :app_id => "178965915518857", :secret => "928b9a0edf812a236499bcc99da7a4bc", :app_url => 'https://apps.facebook.com/truthcanhurt', :email => "dummydata", :password => "dummydata")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def app_id
|
|
17
|
+
current_credentials.app_id
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def viral_url
|
|
21
|
+
app_url + "?marketing_mode=viral"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def advertising_url
|
|
25
|
+
app_url + "?marketing_mode=advertising"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def secret
|
|
29
|
+
current_credentials.secret
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def app_url
|
|
33
|
+
current_credentials.app_url
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def email
|
|
37
|
+
current_credentials.email
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def password
|
|
41
|
+
current_credentials.password
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def current_credentials
|
|
45
|
+
if count == 0
|
|
46
|
+
seed_initial_credentials
|
|
47
|
+
end
|
|
48
|
+
if Rails.env.development?
|
|
49
|
+
last_development_config.last
|
|
50
|
+
else
|
|
51
|
+
last_production_config.last
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require "net/http"
|
|
2
|
+
require "uri"
|
|
3
|
+
module FacebookApp
|
|
4
|
+
class InfographicServerCommunicator
|
|
5
|
+
|
|
6
|
+
INFOGRAPHIC_SERVER_PASSWORD = "henry-hughes"
|
|
7
|
+
SERVER_IP = "http://50.19.35.130"
|
|
8
|
+
SERVER_URL = SERVER_IP + "/infographics"
|
|
9
|
+
|
|
10
|
+
attr_reader :post_parameters
|
|
11
|
+
|
|
12
|
+
def initialize(options)
|
|
13
|
+
@post_parameters = options.merge(:secret => INFOGRAPHIC_SERVER_PASSWORD)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def send_to_server
|
|
17
|
+
Net::HTTP.post_form(URI.parse(SERVER_URL), post_parameters)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
= content_for(:head) do
|
|
2
|
+
meta property="og:type" content="game.achievement"
|
|
3
|
+
meta property="og:title" content="Social Genius"
|
|
4
|
+
meta property="og:url" content=current_url
|
|
5
|
+
meta property="og:description" content="Analysed the group"
|
|
6
|
+
meta property="og:image" content="#{image_url("award_icons/super-socialite.png")}"
|
|
7
|
+
meta property="game:points" content="1000"
|
|
8
|
+
meta property="fb:app_id" content="#{FB.app_id}"
|
|
9
|
+
h3 Social Genius
|
|
10
|
+
p Successfully analysed their group of friends to find out the dirty truth about their friends
|
|
11
|
+
= link_to "Analyse Your Social Network", root_path
|
|
12
|
+
= image_tag "award_icons/super-socialite.png"
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
ul
|
|
2
|
+
li = "Advertising: " + conversion_summary.send(state, :advertising)
|
|
3
|
+
li = "Viral: " + conversion_summary.send(state, :viral)
|
|
4
|
+
li = "Unknown or testing: " + conversion_summary.send(state, nil)
|
|
5
|
+
li.virality= "Virality: " + number_to_percentage(conversion_summary.virality_coefficient(state))
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
h1 Spamalytics
|
|
2
|
+
h2 Unique users who saw permissions dialogue for this app
|
|
3
|
+
= render :partial => 'conversion_stage', :locals => {:state => :permissions_state_count, :conversion_summary => conversion_summary }
|
|
4
|
+
h2 Unique users who installed this facebook app (accepted permissions)
|
|
5
|
+
= render :partial => 'conversion_stage', :locals => {:state => :installed_state_count, :conversion_summary => conversion_summary }
|
|
6
|
+
h2 Unique users who denied permissions for this app (first set of permissions)
|
|
7
|
+
p Note that these users are all redirected to Identified.com, so it's not a complete loss
|
|
8
|
+
= render :partial => 'conversion_stage', :locals => {:state => :denied_state_count, :conversion_summary => conversion_summary }
|
|
9
|
+
h2 Unique users who denied extended permissions for this app (publish rights etc)
|
|
10
|
+
p Note that these users are all redirected to Identified.com, so it's not a complete loss
|
|
11
|
+
= render :partial => 'conversion_stage', :locals => {:state => :denied_extended_state_count, :conversion_summary => conversion_summary }
|
|
12
|
+
h2 Unique users who sent an infographic
|
|
13
|
+
= render :partial => 'conversion_stage', :locals => {:state => :infographic_state_count, :conversion_summary => conversion_summary }
|
|
14
|
+
h2 Unique users who installed Identified app after coming through here
|
|
15
|
+
p Installed the Identified Facebook app (success)
|
|
16
|
+
= render :partial => 'conversion_stage', :locals => {:state => :signed_up_identified_state_count, :conversion_summary => conversion_summary }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
h1 Edit Facebook Credentials
|
|
2
|
+
= link_to "<< Admin", facebook_app.admin_path
|
|
3
|
+
= semantic_form_for(@fb, :url => facebook_app.create_fb_credentials_path) do |f|
|
|
4
|
+
= f.input :app_id
|
|
5
|
+
= f.input :secret
|
|
6
|
+
= f.input :app_url, :hint => "We are now using homepage such as https://www.thedirtytruth.org"
|
|
7
|
+
= f.input :development, :hint => "Default unticked", :required => false
|
|
8
|
+
= f.input :email, :hint => "Fb developer"
|
|
9
|
+
= f.input :password, :hint => "Fb developer"
|
|
10
|
+
= f.buttons
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#spamalytics
|
|
2
|
+
= render :partial => 'spamalytics', :locals => {:conversion_summary => @conversion_summary}
|
|
3
|
+
h2 Testing
|
|
4
|
+
p Delete all stored conversion data. Useful for testing conversions are working.
|
|
5
|
+
= button_to "Delete Data", facebook_app.clear_conversion_data_path, :confirm => "Are you sure you want to permanently delete all conversion data?"
|
|
6
|
+
p Remove app permission. Useful for checking if permissions dialogue shows at right time. Will log you in if you are logged out.
|
|
7
|
+
= button_to "Log me out", facebook_app.log_me_out_path
|
|
8
|
+
p Register Achievements With Facebook(must be done with each new app)
|
|
9
|
+
= button_to "Register Achivements", facebook_app.register_with_fb_achievement_path(1)
|
|
10
|
+
|
|
11
|
+
ul
|
|
12
|
+
li
|
|
13
|
+
h1 Current Facebook Credentials
|
|
14
|
+
- if @fb
|
|
15
|
+
ul
|
|
16
|
+
li = "App_id: " + @fb.app_id
|
|
17
|
+
li = "App Secret: " + @fb.secret
|
|
18
|
+
li = "Canvas Page Url: " + @fb.app_url
|
|
19
|
+
li = "Developer Account Email: " + @fb.email
|
|
20
|
+
li = "Developer Account Password: " + @fb.password
|
|
21
|
+
= link_to "Change FB Credentials", facebook_app.new_fb_credentials_path
|
|
22
|
+
h1 Other app based settings
|
|
23
|
+
p = link_to "See or modify settings", admin_configurable_path
|
|
24
|
+
h1 Links to last twenty infographics
|
|
25
|
+
h1 Urls for tracking traffic sources
|
|
26
|
+
p These are modified urls with special parameters appended to them which allow the app to track where traffic came from.
|
|
27
|
+
li Url for viral marketing is #{FacebookApp::FacebookCredentials.viral_url} (this is used by the app in captions and so on)
|
|
28
|
+
li Url for paid advertising is #{FacebookApp::FacebookCredentials.advertising_url}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#privacy
|
|
2
|
+
h1 PRIVACY POLICY
|
|
3
|
+
|
|
4
|
+
p #{@app_name} respects the privacy rights of our online users and is committed to protecting the personal information collected about or provided by you.
|
|
5
|
+
|
|
6
|
+
h2 Information Collected
|
|
7
|
+
|
|
8
|
+
p In order to give you the best experience in use of the Service, #{@app_name} may collect information about you from your account on Facebook, but only if you voluntarily provide it to us, in accordance with the policies and terms of Facebook.
|
|
9
|
+
|
|
10
|
+
p The types of personal information collected in conjunction with the activities listed above will vary depending on the activity. The requested information may include: (i) your name, (ii) e-mail address, (iii) information about the identity of your friends, used to analyze your friends’ profiles.
|
|
11
|
+
|
|
12
|
+
h2 Use of Information collected.
|
|
13
|
+
|
|
14
|
+
p #{@app_name} will only use the personal information collected from you or from Facebook for the operation of the Service in accordance with the policies and terms of Facebook. #{@app_name} does not rent, lease, loan, sell, voluntarily distribute or redistribute your personal information to any unaffiliated third parties.
|
|
15
|
+
|
|
16
|
+
p No matter what method we use to collect information and no matter how we use that information, we will only collect the information deemed reasonably necessary to fulfill your online requests and our legitimate business objectives, and such information will not be provided to any third parties.
|
|
17
|
+
|
|
18
|
+
h2 Other Disclosure of Your Personal Information
|
|
19
|
+
|
|
20
|
+
p Notwithstanding any other terms of this Privacy Policy, we may disclose personal information in the good faith belief that we are required to do so by law, including but not limited to disclosure to law enforcement or other government officials in connection with an investigation of fraud, intellectual property infringements, or other activity that is illegal or may expose you or us to legal liability.
|
|
21
|
+
|
|
22
|
+
h2 Not Providing Information
|
|
23
|
+
|
|
24
|
+
p If you choose not to submit personal information when requested, you may not be able to use many of the features offered the Service.
|
|
25
|
+
|
|
26
|
+
h2 Privacy Policy and Third Party Web Sites, Links, Advertisements and Services
|
|
27
|
+
|
|
28
|
+
p You should be aware that while you are using our Service, you may be directed to other sites that are beyond our control and for which we are not responsible. Additionally, third parties provide advertisements and offer other products and services to you when you are using our Service, which may receive your IP address or other technology such as cookies, web beacons and the like. By using the Service, you consent to such use by third parties of your personal information, which is subject to the privacy policies of these third parties.
|
|
29
|
+
|
|
30
|
+
p You should consult the privacy policies of these third parties for more detailed information.
|
|
31
|
+
|
|
32
|
+
h2 California Privacy Rights
|
|
33
|
+
|
|
34
|
+
h2 Your California Privacy Rights
|
|
35
|
+
|
|
36
|
+
p Since 2005, California Civil Code Section 1798.83 permits customers who are California residents to request certain information regarding our disclosure of personal information to third parties for their direct marketing purposes. For inquires about this issue, please email us using the "Contact Developer" link provided on the application page by Facebook.
|
|
37
|
+
|
|
38
|
+
h2 Ask a Question about Privacy Policy
|
|
39
|
+
|
|
40
|
+
p If you have any questions, complaints, or comments regarding this Privacy Policy or our information collection practices, please contact our Privacy Policy Administrator using the "Contact Developer" link provided on the application page by Facebook.
|
|
41
|
+
|
|
42
|
+
h2 Policy Regarding Children Under 13
|
|
43
|
+
|
|
44
|
+
p We do not knowingly collect personal information such as name and email address from children under 13. In the event that we learn that we have collected personal information from a child under the age of thirteen, we will delete the information as quickly as possible.
|
|
45
|
+
|
|
46
|
+
h2 Policy Regarding Children Over 13
|
|
47
|
+
|
|
48
|
+
p We request that any person under the age of majority in their jurisdiction ask the permission of their parents before providing any information to us or anyone else over the Internet.
|
|
49
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#privacy
|
|
2
|
+
h1 TERMS OF SERVICE
|
|
3
|
+
|
|
4
|
+
h2 Acceptance of Terms
|
|
5
|
+
|
|
6
|
+
p These Terms of Use govern your use of the games, computer applications and other services (collectively the “Service”) available on, or offered by, #{@app_name} on Facebook. These Terms of Service apply to all users of the Service, including users who are also contributors of content, information and other materials to the Service. If you do not agree to these Terms of Use, you are not permitted to access, browse or use the Service. The Terms of Use are personal to you, and are not assignable, transferable or sub-licensable by you.
|
|
7
|
+
|
|
8
|
+
h2 Changes to the Terms of Use
|
|
9
|
+
|
|
10
|
+
p We reserve the right, at our discretion, to update or revise these Terms of Use at any time. We will post such changes to these Terms of Use, and these additional or revised terms will become part of the agreement. Please check this Terms of Use document periodically for changes. Your continued use of the Service constitutes your binding acceptance of these Terms of Use, including any changes or modifications made by #{@app_name} as referenced above.
|
|
11
|
+
|
|
12
|
+
h2 Content
|
|
13
|
+
|
|
14
|
+
p Although the Service has been compiled in good faith, no representation is made as to the completeness or accuracy of the information it contains. The information contained on the Service may be incomplete, may contain errors, or become out-of-date.
|
|
15
|
+
|
|
16
|
+
h2 Limitations on Your Use
|
|
17
|
+
|
|
18
|
+
p You agree to abide by all applicable local, state, national, and international laws and regulations in using the Service, and not to use the Service for any purpose that is prohibited by the Terms of Use. You agree not: to (a) use Service for illegal purposes; (b) use Service in any manner which violates the rights of a third party, including without limitation intellectual property rights; (c) use the Service to post or otherwise communicate material which is unlawful, harassing, libelous, privacy invading, abusive, threatening, harmful, vulgar, pornographic, obscene, indecent, confidential, proprietary or otherwise objectionable, (d) use the Service for any commercial purpose; (e) post any links to any external Internet website that are obscene or pornographic or to post or otherwise communicate commercial advertisements, chain letters, pyramid schemes, encoded binary files, job offers or listings or personal ads; (f) use Service to provide materials which contain viruses or other contaminating or destructive features; (g) impersonates any person or entity, including any employee or representative of a third party; (h) cheat or copy in any form with respect to any Services offered; or (h) create an account or provide any other information under false pretenses, with false or incomplete information, or to mislead others.
|
|
19
|
+
|
|
20
|
+
p Additionally, you shall not: (a) take any action that imposes or may impose (as determined by #{@app_name} in its sole discretion) an unreasonable or disproportionately large load on #{@app_name}’s (or its third party providers’) infrastructure; (b) interfere or attempt to interfere with the proper working of the Service or any activities conducted in connection with the Service; or (iii) bypass any measures #{@app_name} may use to prevent or restrict access to the Service.
|
|
21
|
+
|
|
22
|
+
h2 The Service is provided only for your own personal use.
|
|
23
|
+
|
|
24
|
+
h2 Limitations on Liability
|
|
25
|
+
|
|
26
|
+
p #{@app_name} PROVIDES THE SERVICE "AS IS" AND DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR OTHERWISE IMPLIED, INCLUDING WITHOUT LIMITATION THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT, AS TO THE INFORMATION, CONTENT, GAMES OR OTHER MATERIALS MADE AVAILABLE USING THE SERVICE OR AS TO THE RESULTS TO BE OBTAINED FROM USE OF THE SERVICE. #{@app_name} AND ITS AFFILIATES, AND EACH OF THEIR DIRECTORS, EMPLOYEES, AGENTS AND REPRESENTATIVES DO NOT WARRANT THAT: (a) THE SERVICE WILL BE SECURE OR AVAILABLE AT ANY PARTICULAR TIME OR LOCATION; (b) ANY DEFECTS OR ERRORS WILL BE CORRECTED: (c) ANY CONTENT OR SOFTWARE AVAILABLE AT OR THROUGH THE SERVICE IS FREE OF VIRUSES OR OTHER HARMFUL COMPONENTS; OR (D) THE RESULTS OF SUING THE SERVICE WILL MEET YOUR EXPECTATIONS OR REQUIREMENTS.
|
|
27
|
+
|
|
28
|
+
p YOU ACCEPT ALL RESPONSIBILITY FOR THE INFORMATION, CONTENT AND OTHER MATERIALS YOU POST OR OTHERWISE COMMUNICATE USING THE SERVICE. #{@app_name} SHALL HAVE NO LIABILITY FOR THE ACCURACY OR CONTENT OF THE INFORMATION CONTAINED IN OR THE GAMES ON THE SERVICE, OR FOR DELAYS OR OMISSIONS THEREIN. NOR SHALL #{@app_name}, ITS AFFILIATES AND EACH OF THEIR DIRECTORS, EMPLOYEES, AGENTS AND REPRESENTATIVES, BE LIABLE FOR ANY THIRD-PARTY CLAIMS OR LOSSES OF ANY NATURE, INCLUDING BUT NOT LIMITED TO, LOST PROFITS, PUNITIVE, INDIRECT OR CONSEQUENTIAL DAMAGES. NOTWITHSTANDING THE ABOVE, YOU AGREE THAT THE MAXIMUM LIABILITY OF #{@app_name} IN CONNECTION WITH OR ARISING FROM ANY USE OF THE SERVICE, INCLUDING ANY APPLICATIONS OR GAMES, SHALL BE LIMITED TO $200 IN THE AGGREGATE PER USER.
|
|
29
|
+
|
|
30
|
+
p SOME STATES DO NOT ALLOW EXCLUSION OF IMPLIED WARRANTIES OR LIMITATION OF LIABILITY FOR INCIDENTAL, EXEMPLARY, PUNITIVE, DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATIONS OR EXCLUSIONS MAY NOT APPLY TO YOU. IN SUCH STATES, THE LIABILITY OF #{@app_name} SHALL BE LIMITED TO THE GREATEST EXTENT PERMITTED BY LAW.
|
|
31
|
+
|
|
32
|
+
h2 Our Intellectual Property
|
|
33
|
+
|
|
34
|
+
p You acknowledge and agree that all content, design elements, and materials available on this Service are protected by copyrights, trademarks, service marks, patents, trade secrets, or other proprietary rights and laws. No materials from this Service may be copied, reproduced, modified, republished, uploaded, posted, transmitted or distributed in any form or for any means without our prior written permission. Furthermore, you agree to not sell, license, rent, or create derivative works from such materials or content. Systematic retrieval of content from the Service to create or compile, directly or indirectly, a collection, compilation, database, or directory without written permission from us is strictly prohibited.
|
|
35
|
+
|
|
36
|
+
p All rights not expressly granted herein are reserved. Any unauthorized use of the materials appearing on the Service may violate copyright, trademark and other applicable laws.
|
|
37
|
+
|
|
38
|
+
p Except as provided below, #{@app_name} and its affiliates and licensors retain all right, title and interest in and to the Service, excluding your User Content ("#{@app_name} Intellectual Property"). You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, link, display, or in any way exploit the #{@app_name} Intellectual Property, in whole or in party, except as expressly permitted in these Terms of Use or with the prior written consent of #{@app_name}. You agree to use the Service only in accordance with these Terms of Use. You agree not to disassemble, decompile or reverse-engineer any software or other component of the #{@app_name} website.
|
|
39
|
+
|
|
40
|
+
p Please be advised that any information related to the Service including but not limited to, game scores and player rankings, are the property of #{@app_name} by operation of these Terms of Use. #{@app_name} reserves the right to display, modify, distribute, reproduce, use for promotional purposes, or delete any of this information at any time and for any reason without notice. Further, as the sole owner of all such content, feedback, opinions, and strategies, #{@app_name} may elect to utilize such information and to make changes or improvements based on that information without any payment or consideration of any kind to any party who provides information.
|
|
41
|
+
|
|
42
|
+
h2 Disputes with Users of the Service
|
|
43
|
+
|
|
44
|
+
p #{@app_name} is not obligated to investigate, monitor, mediate or resolve any dispute you may have with another user of the Service although we may undertake such action in its sole discretion. In the event of a dispute with another user of the Service, you agree (a) to indemnify us from any liability and (b) that we will not be liable, for any type of damages or for any type of claim or demand arising out of or related to any dispute you may have with any other user of the Service.
|
|
45
|
+
|
|
46
|
+
h2 Relationship of You and Us When You Use Our Service
|
|
47
|
+
|
|
48
|
+
p No agency, partnership, joint venture, or employment relationship is created as a result of these Terms of Use. Neither party has any authority of any kind to bind the other in any respect. Games in Beta mean that we reserve the right to tweak gameplay, prices of items, etc as we see fit to create the best user experience. We may also discontinue support of a game at any time due to resource restrictions.
|
|
49
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
doctype html
|
|
2
|
+
html xmlns="https://www.w3.org/1999/xhtml" xmlns:fb="https://www.facebook.com/2008/fbml"
|
|
3
|
+
head
|
|
4
|
+
title
|
|
5
|
+
= title
|
|
6
|
+
meta name="description" content=seo_desc
|
|
7
|
+
= javascript_include_tag "application"
|
|
8
|
+
= csrf_meta_tags
|
|
9
|
+
= stylesheet_link_tag "application"
|
|
10
|
+
= google_analytics
|
|
11
|
+
= yield(:head)
|
|
12
|
+
body
|
|
13
|
+
#header
|
|
14
|
+
#content
|
|
15
|
+
- if flash[:notice]
|
|
16
|
+
h2 = flash[:notice]
|
|
17
|
+
= yield
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
FacebookApp::Engine.routes.draw do
|
|
2
|
+
|
|
3
|
+
scope(:module => :facebook_app) do
|
|
4
|
+
resources :achievements do
|
|
5
|
+
member do
|
|
6
|
+
post :register_with_fb
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
match "/oauth_callback" => "oauth#create", :as => :oauth_callback
|
|
11
|
+
match "/denied" => "oauth#denied", :as => :denied
|
|
12
|
+
|
|
13
|
+
match "/privacy_policy" => "pages#privacy_policy"
|
|
14
|
+
match "/terms_of_service" => "pages#terms_of_service"
|
|
15
|
+
|
|
16
|
+
get "/admin" => "admin#show"
|
|
17
|
+
post "/admin/clear_conversion_data" => "admin#clear_conversion_data", :as => :clear_conversion_data
|
|
18
|
+
post "/admin/log_me_out" => "admin#log_me_out", :as => :log_me_out
|
|
19
|
+
|
|
20
|
+
post "/create_fb_credentials" => "admin#create_fb_credentials"
|
|
21
|
+
get "/new_fb_credentials" => "admin#new_fb_credentials"
|
|
22
|
+
|
|
23
|
+
unless Rails.env.development? && Configurable.nil?
|
|
24
|
+
get "/identified" => redirect(Configurable[:identified_tracking_link]), :as => :identified
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
get "/external_tracking/identified_signup" => "external_trackings#identified_signup", :as => :identified_signup_tracking
|
|
28
|
+
get "/external_tracking/test" => "external_trackings#test"
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
class AddFacebookApp < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :configurables do |t|
|
|
4
|
+
t.string :name
|
|
5
|
+
t.string :value
|
|
6
|
+
t.timestamps
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
add_index :configurables, :name
|
|
10
|
+
|
|
11
|
+
create_table "facebook_app_conversions", :force => true do |t|
|
|
12
|
+
t.string "marketing_mode"
|
|
13
|
+
t.string "state"
|
|
14
|
+
t.string "uid"
|
|
15
|
+
t.datetime "created_at"
|
|
16
|
+
t.datetime "updated_at"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
create_table "facebook_app_facebook_credentials", :force => true do |t|
|
|
20
|
+
t.string "app_id"
|
|
21
|
+
t.string "app_url"
|
|
22
|
+
t.string "secret"
|
|
23
|
+
t.boolean "development", :default => false
|
|
24
|
+
t.string "email"
|
|
25
|
+
t.string "password"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|