track email subscribe in analytics

This commit is contained in:
kauffj 2015-11-29 17:51:06 -05:00
parent 910be60712
commit 6655e673da
6 changed files with 34 additions and 68 deletions

View file

@ -28,14 +28,16 @@ class MailActions extends Actions
$mcApi = new Mailchimp();
$mcListId = $_POST['listId'];
$mergeFields = isset($_POST['mergeFields']) ? unserialize($_POST['mergeFields']) : [];
if ($mcApi->listSubscribe($mcListId, $email, $mergeFields, 'html', false))
$success = $mcApi->listSubscribe($mcListId, $email, $mergeFields, 'html', false);
if ($success)
{
Session::set(Session::KEY_MAILCHIMP_LIST_IDS, array_merge(Session::get(Session::KEY_MAILCHIMP_LIST_IDS, []), [$mcListId]));
Session::set('list_success', __('Great success! Welcome to LBRY.'));
}
else
{
Session::set('list_error', __('Something went wrong adding you to the list.'));
$error = $mcApi->errorMessage ?: __('Something went wrong adding you to the list.');
Session::set('list_error', $error);
}
}

View file

@ -1,5 +1,4 @@
<?php
/**
* Description of Response
*
@ -9,6 +8,7 @@ class Response
{
protected static $metaDescription = '',
$metaTitle = '',
$jsCalls = [],
// $bodyCssClasses = [],
$metaImg = '';
@ -59,6 +59,17 @@ class Response
}
return $title;
}
public static function getJsCalls()
{
return static::$jsCalls;
}
public static function jsOutputCallback($js)
{
static::$jsCalls[] = $js;
return '';
}
// public static function addBodyCssClass($classOrClasses)
// {

View file

@ -1,5 +1,15 @@
<?php
function js_start()
{
ob_start('Response::jsOutputCallback');
}
function js_end()
{
ob_end_flush();
}
/**
* Description of View
*

View file

@ -56,6 +56,9 @@
ga('send', 'pageview');
</script>
<script>
<?php echo implode("\n", Response::getJsCalls()) ?>
</script>
</div>
</div>
</body>

View file

@ -1,3 +1,8 @@
<?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>

View file

@ -1,65 +0,0 @@
<?php Response::setMetaDescription('Download or install the latest version of LBRY.') ?>
<?php echo View::render('nav/header', ['isDark' => false]) ?>
<?php throw new Exception('not used atm') ?>
<div class="content spacer1">
<h1>Get LBRY</h1>
<div class="notice notice-info">
<strong>This is a pre-release, alpha version of LBRY.</strong> It is only designed to show what LBRY makes possible.
Expect future releases to involve a full network reboot of both credits and metadata.
</div>
</div>
<div class="content">
<h2>Install</h2>
<div class="row-fluid">
<div class="span4">
<h3><span class="icon-windows"></span> Windows</h3>
<p class="meta">
If you have a standard Windows install, it will insinuate several times that you are an idiot for following the steps below.
And perhaps you are, but not because this code is dangerous or will harm your computer in any way. Future releases will involve more reputable install steps.
</p>
<ol>
<li>Download <a href="https://github.com/lbryio/lbry/releases/download/alpha/lbry-windows.zip" class="link-primary">this ZIP</a> file.</li>
<li>There is no installer. Extract the ZIP to wherever you want the program to reside, such as <code>Program Files</code>.</li>
<li>Run lbry.exe.</li>
</ol>
</div>
<div class="span4">
<h3><span class="icon-linux"></span> Linux</h3>
<div>
<h4>The Brave and Lazy</h4>
<ol>
<li>Make a folder called <code>lbry</code> where you want everything to reside.</li>
<li>Download and run <a href="https://raw.githubusercontent.com/lbryio/lbry-setup/master/lbry_setup.sh" class="link-primary">this shell script</a> from that folder.</li>
</ol>
<h4>The Shrewd and Frivolous</h4>
<ol>
<li>Clone and follow the build steps for <a href="https://github.com/lbryio/lbrycrd" class="link-primary">lbrycrd</a>, a miner for LBRY credits.</li>
<li>Clone and follow the build steps for <a href="https://github.com/lbryio/lbry" class="link-primary">lbry</a>, a console based application for using the LBRY protocol.</li>
</ol>
</div>
</div>
<div class="span4">
<h3><span class="icon-apple"></span> OS X</h3>
<div>
<h4>OS X Programmers</h4>
<p>You can attempt to follow the Linux build instructions.</p>
<h4>Everyone Else</h4>
<p>Sorry, we do not have an OS X version of LBRY other than source. We promise one will exist sooner rather than later.</p>
</div>
</div>
</div>
<h2>Test</h2>
<p>To ensure LBRY is installed correctly, try accessing a piece of content:</p>
<div class="text-center spacer1">
<code>lbry://wonderfullife</code>
</div>
<p class="meta">In the graphical version, this can accessed by typing "wonderfullife" into the address bar and pressing "Go". In the console version, select "[7] Add a stream from a short name".</p>
<div class="spacer2">
<h2>Feedback</h2>
<p>We've prepared a short form for feedback regarding your LBRY experience, available below.</p>
<p>We're providing 10,000 LBC (~$100) to the first 500 people who download LBRY and submit their feedback.</p>
<p><a href="https://docs.google.com/forms/d/1zqa5jBYQMmrZO1utoF2Ok9ka-gXzXLDZKXNNoprufC8/viewform" class="btn-primary">Provide Your Feedback</a></p>
</div>
</div>
<?php echo View::render('nav/footer') ?>