move feedback collection onto lbry, improve analytics, add support for analytics event on feedback submit, single reference to reward value

This commit is contained in:
Jeremy Kauffman 2015-12-31 18:03:59 -05:00
parent 11ab481531
commit 1f4af8a759
13 changed files with 99 additions and 52 deletions

View file

@ -7,6 +7,11 @@
*/
class CreditApi
{
public static function getCurrentTestCreditReward()
{
return 1000;
}
public static function getTotalDollarSales()
{
return 22585;

View file

@ -80,7 +80,7 @@ class Response
public static function addJsAsset($src)
{
static::$assets['js'][] = $src;
static::$assets['js'][$src] = $src;
}
public static function getJsAssets()

View file

@ -1,14 +0,0 @@
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '1618717031725766');
fbq('track', "Lead");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=1618717031725766&ev=PageView&noscript=1"
/></noscript>
<!--End Facebook Pixel Code-->

View file

@ -1,8 +0,0 @@
<?php Response::addJsAsset('//platform.twitter.com/oct.js') ?>
<?php js_start() ?>
twttr.conversion.trackPid('nty1x', { tw_sale_amount: 0, tw_order_quantity: 0 });
<?php js_end() ?>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://analytics.twitter.com/i/adsct?txn_id=nty1x&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0" />
<img height="1" width="1" style="display:none;" alt="" src="//t.co/i/adsct?txn_id=nty1x&p_id=Twitter&tw_sale_amount=0&tw_order_quantity=0" />
</noscript>

View file

@ -0,0 +1,9 @@
<?php $reward = CreditApi::getCurrentTestCreditReward() ?>
<p>
Regardless of whether you got LBRY to run or not, your feedback is immensely valuable.
Everyone who made <em>any</em> effort to install and complete the survey below will receive <?php echo i18n::formatCredits($reward) ?>*.
</p>
<div class="meta spacer1">
*What is this worth? Who knows! But it will be the largest reward we will <strong>ever</strong> offer to early adopters.
</div>

View file

@ -1,12 +1,7 @@
<?php $reward = CreditApi::getCurrentTestCreditReward() ?>
<div class="cover cover-dark cover-dark-grad content content-dark">
<h1>Test and Earn</h1>
<p>
Regardless of whether you got LBRY to run or not, your feedback is immensely valuable.
Everyone who made <em>any</em> effort to install and complete the survey below will receive 1,000 LBC*.
</p>
<div class="meta">
*What is this worth? Who knows! But it will be the largest reward we will <strong>ever</strong> offer to early adopters. Alternatively, if you complete our survey we will pay you in hugs.
</div>
<?php echo View::render('get/feedback-prompt') ?>
<h3>Test Your Install</h3>
<ol>
<li>Run <code>lbrynet-console</code> from the command line</li>
@ -15,8 +10,8 @@
</ol>
<h3>Feedback</h3>
<p>
Everyone who completes our brief feedback survey will receive 1,000 LBC and your feedback will be personally read by the developers.
Completing this survey also helps signal interest in LBRY to investors.
In addition to <?php echo i18n::formatCredits($reward) ?>, your feedback will be personally read by the developers and help signal
interest in LBRY to investors.
</p>
<a href="https://docs.google.com/forms/d/1zqa5jBYQMmrZO1utoF2Ok9ka-gXzXLDZKXNNoprufC8/viewform" class="btn-alt">Provide Your Feedback</a>
<a href="/feedback" class="btn-alt">Provide Your Feedback</a>
</div>

View file

@ -52,6 +52,7 @@
<script src="<?php echo $src ?>"></script>
<?php endforeach ?>
<script>
<?php //google analytics ?>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
@ -60,6 +61,7 @@
ga('create', 'UA-60403362-1', 'auto');
ga('send', 'pageview');
<?php //facebook sdk and events (do we need both??) ?>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
@ -67,7 +69,14 @@
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1477813539180850";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
<?php //twitter ?>
window.twttr = (function(d,s,id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
@ -84,6 +93,9 @@
return t;
}(document, "script", "twitter-wjs"));
<?php //and now everyone knows what happens on our website except us ?>
</script>
<script>
<?php echo implode("\n", Response::getJsCalls()) ?>

View file

@ -1,14 +1,14 @@
<?php if ($success): ?>
<?php js_start() ?>
ga('send', 'event', 'Sign Up', 'Join List', '<?php echo $listId ?>');
<?php js_end() ?>
<?php endif ?>
<form action="/list-subscribe" method="post" novalidate>
<?php if ($error): ?>
<div class="notice notice-error spacer1"><?php echo $error ?></div>
<?php elseif ($success): ?>
<?php echo View::render('analytics/subTwitter') ?>
<?php echo View::render('analytics/subFacebook') ?>
<?php Response::addJsAsset('//platform.twitter.com/oct.js') ?>
<?php js_start() ?>
ga('send', 'event', 'Sign Up', 'Join List', '<?php echo $listId ?>');
twttr.conversion.trackPid('nty1x');
fbq('init', '1618717031725766');
fbq('track', "Lead");
<?php js_end() ?>
<div class="notice notice-success spacer1"><?php echo $success ?></div>
<?php endif ?>
<div class="mail-submit">

34
view/page/feedback.php Normal file
View file

@ -0,0 +1,34 @@
<?php Response::setMetaDescription('Provide feedback on your experience using LBRY.') ?>
<?php Response::setMetaTitle(__('Feedback')) ?>
<?php echo View::render('nav/header', ['isDark' => false]) ?>
<main class="cover-stretch-wrap" >
<div class="cover cover-dark cover-dark-grad">
<div class="content-dark content" style="min-height: 100%">
<div class="row-fluid" style="height: 100%">
<div class="span9">
<h1><?php echo __('Feedback') ?></h1>
<?php echo View::render('get/feedback-prompt') ?>jeremy again
<iframe id="feedback-form-iframe" src="https://docs.google.com/forms/d/1zqa5jBYQMmrZO1utoF2Ok9ka-gXzXLDZKXNNoprufC8/viewform?embedded=true"
width="760" height="1720" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe>
</div>
<div class="span3">
<?php echo View::render('social/sidebar') ?>
</div>
</div>
</div>
</div>
</main>
<?php js_start() ?>
$(function() {
var count = 0;
$('#feedback-form-iframe').load(function(){
++count;
if (count == 2) //2nd load = a submit
{
ga('send', 'event', 'Alpha Test', 'Feedback Form');
//twttr.conversion.trackPid('nty1x');
//fbq('track', "Alpha");
}
});
});
<?php js_end() ?>

View file

@ -17,16 +17,7 @@
]) ?>
</div>
<div class="span3">
<h3><?php echo __('Also On') ?></h3>
<div class="spacer1">
<a href="//twitter.com/lbryio" class="link-primary"><span class="icon icon-twitter"></span><span class="btn-label">Twitter</span></a>
</div>
<div class="spacer1">
<a href="//www.facebook.com/lbryio" class="link-primary"><span class="icon icon-facebook"></span> <span class="btn-label">Facebook</span></a>
</div>
<div class="spacer1">
<a href="//reddit.com/r/lbry" class="link-primary"><span class="icon icon-reddit"></span><span class="btn-label">Reddit</span></a>
</div>
<?php echo View::render('social/sidebar') ?>
</div>
</div>
</div>

10
view/social/sidebar.php Normal file
View file

@ -0,0 +1,10 @@
<h3><?php echo __('Also On') ?></h3>
<div class="spacer1">
<a href="//twitter.com/lbryio" class="link-primary"><span class="icon icon-twitter"></span><span class="btn-label">Twitter</span></a>
</div>
<div class="spacer1">
<a href="//www.facebook.com/lbryio" class="link-primary"><span class="icon icon-facebook"></span> <span class="btn-label">Facebook</span></a>
</div>
<div class="spacer1">
<a href="//reddit.com/r/lbry" class="link-primary"><span class="icon icon-reddit"></span><span class="btn-label">Reddit</span></a>
</div>

View file

@ -1,3 +1,4 @@
window.lbry = {};
document.domain = 'lbry.io';
jQuery.fn.extend({
@ -17,6 +18,13 @@ jQuery.fn.extend({
}
});
lbry.foo = function()
{
$('#iframeid').load(function(){
alert('frame has (re)loaded');
});
}
$(document).ready(function() {
var body = $('body'),
labelCycles = body.find('.label-cycle'); //should use better pattern but we have so little JS right now
@ -150,4 +158,4 @@ $(document).ready(function() {
});
});
}
});
});

View file

@ -17,6 +17,11 @@ input[type="email"], input[type="text"]
height: $spacing-vertical * 1.5;
}
textarea
{
width: 100%;
}
.form-row
{
margin-bottom: $spacing-vertical;