mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
twitter analytics callback on sub
This commit is contained in:
parent
80d487532f
commit
4d40dcaa6f
6 changed files with 122 additions and 94 deletions
|
@ -7,7 +7,8 @@
|
|||
*/
|
||||
class Session
|
||||
{
|
||||
const KEY_MAILCHIMP_LIST_IDS = 'mailchimp_list_ids';
|
||||
const KEY_MAILCHIMP_LIST_IDS = 'mailchimp_list_ids',
|
||||
KEY_LIST_SUB_SUCCESS = 'list_success';
|
||||
|
||||
public static function init()
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ class MailActions extends Actions
|
|||
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.'));
|
||||
Session::set(Session::KEY_LIST_SUB_SUCCESS, __('Great success! Welcome to LBRY.'));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -48,9 +48,9 @@ class MailActions extends Actions
|
|||
{
|
||||
$vars += ['btnClass' => 'btn-primary', 'returnUrl' => $_SERVER['REQUEST_URI']];
|
||||
$vars['error'] = Session::get('list_error');
|
||||
$vars['success'] = Session::get('list_success');
|
||||
$vars['success'] = Session::get(Session::KEY_LIST_SUB_SUCCESS);
|
||||
Session::unsetKey('list_error');
|
||||
Session::unsetKey('list_success');
|
||||
Session::unsetKey(Session::KEY_LIST_SUB_SUCCESS);
|
||||
return $vars;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,13 @@ class Response
|
|||
protected static $metaDescription = '',
|
||||
$metaTitle = '',
|
||||
$jsCalls = [],
|
||||
$assets = [
|
||||
'js' => [
|
||||
'/js/jquery-2.1.3.min.js',
|
||||
'/js/global.js'
|
||||
],
|
||||
'css' => []
|
||||
],
|
||||
// $bodyCssClasses = [],
|
||||
$metaImg = '';
|
||||
|
||||
|
@ -71,6 +78,16 @@ class Response
|
|||
return '';
|
||||
}
|
||||
|
||||
public static function addJsAsset($src)
|
||||
{
|
||||
static::$assets['js'][] = $src;
|
||||
}
|
||||
|
||||
public static function getJsAssets()
|
||||
{
|
||||
return static::$assets['js'];
|
||||
}
|
||||
|
||||
// public static function addBodyCssClass($classOrClasses)
|
||||
// {
|
||||
// static::$bodyCssClasses = array_unique(array_merge(static::$bodyCssClasses, (array)$classOrClasses));
|
||||
|
|
8
view/analytics/subTwitter.php
Normal file
8
view/analytics/subTwitter.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?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>
|
|
@ -1,91 +1,92 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head prefix="og: http://ogp.me/ns#">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
<?php $title = Response::getMetaTitle() ?: Response::guessMetaTitle($content) ?>
|
||||
<?php $title = $title ?
|
||||
$title . (strpos($title, 'LBRY') === false ? ' - LBRY' : '') :
|
||||
'LBRY' ?>
|
||||
<title><?php echo $title ?></title>
|
||||
|
||||
<link href='//fonts.googleapis.com/css?family=Raleway:600,300' rel='stylesheet' type='text/css'>
|
||||
<link href="/css/all.css" rel="stylesheet" type="text/css" media="screen,print" />
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="/img/fav/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="/img/fav/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="/img/fav/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="/img/fav/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/img/fav/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="/img/fav/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="/img/fav/favicon-194x194.png" sizes="194x194">
|
||||
<link rel="icon" type="image/png" href="/img/fav/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="/img/fav/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="/img/fav/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="/img/fav/manifest.json">
|
||||
|
||||
<meta name="description" content="<?php echo Response::getMetaDescription() ?>">
|
||||
<meta name="msapplication-TileColor" content="#155B4A">
|
||||
<meta name="msapplication-TileImage" content="/mstile-144x144.png">
|
||||
<meta name="theme-color" content="#155B4A">
|
||||
<!-- Twitter Card data -->
|
||||
<meta name="twitter:site" content="@lbryio">
|
||||
<meta name="twitter:creator" content="@lbryio">
|
||||
|
||||
<!-- Open Graph data -->
|
||||
<meta property="og:title" content="<?php echo $title ?>" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:image" content="<?php echo Response::getMetaImage() ?>" />
|
||||
<meta property="og:description" content="<?php echo Response::getMetaDescription() ?>"/>
|
||||
<meta property="og:site_name" content="LBRY" />
|
||||
|
||||
<base target="_parent" />
|
||||
</head>
|
||||
<body>
|
||||
<?php echo $content ?>
|
||||
<div class="hide">
|
||||
<div id="fb-root"></div>
|
||||
<div id="js">
|
||||
<script src="/js/jquery-2.1.3.min.js"></script>
|
||||
<script src="/js/global.js"></script>
|
||||
<script>
|
||||
(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)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-60403362-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) return;
|
||||
js = d.createElement(s); js.id = id;
|
||||
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'));
|
||||
|
||||
window.twttr = (function(d,s,id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0],
|
||||
t = window.twttr || {};
|
||||
if (d.getElementById(id)) return;
|
||||
js = d.createElement(s);
|
||||
js.id = id;
|
||||
js.src = "//platform.twitter.com/widgets.js";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
|
||||
t._e = [];
|
||||
t.ready = function(f) {
|
||||
t._e.push(f);
|
||||
};
|
||||
|
||||
return t;
|
||||
}(document, "script", "twitter-wjs"));
|
||||
</script>
|
||||
<script>
|
||||
<?php echo implode("\n", Response::getJsCalls()) ?>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head prefix="og: http://ogp.me/ns#">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
<?php $title = Response::getMetaTitle() ?: Response::guessMetaTitle($content) ?>
|
||||
<?php $title = $title ?
|
||||
$title . (strpos($title, 'LBRY') === false ? ' - LBRY' : '') :
|
||||
'LBRY' ?>
|
||||
<title><?php echo $title ?></title>
|
||||
|
||||
<link href='//fonts.googleapis.com/css?family=Raleway:600,300' rel='stylesheet' type='text/css'>
|
||||
<link href="/css/all.css" rel="stylesheet" type="text/css" media="screen,print" />
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="/img/fav/apple-touch-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="/img/fav/apple-touch-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="/img/fav/apple-touch-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="/img/fav/apple-touch-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/img/fav/apple-touch-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" href="/img/fav/favicon-32x32.png" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="/img/fav/favicon-194x194.png" sizes="194x194">
|
||||
<link rel="icon" type="image/png" href="/img/fav/favicon-96x96.png" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="/img/fav/android-chrome-192x192.png" sizes="192x192">
|
||||
<link rel="icon" type="image/png" href="/img/fav/favicon-16x16.png" sizes="16x16">
|
||||
<link rel="manifest" href="/img/fav/manifest.json">
|
||||
|
||||
<meta name="description" content="<?php echo Response::getMetaDescription() ?>">
|
||||
<meta name="msapplication-TileColor" content="#155B4A">
|
||||
<meta name="msapplication-TileImage" content="/mstile-144x144.png">
|
||||
<meta name="theme-color" content="#155B4A">
|
||||
<!-- Twitter Card data -->
|
||||
<meta name="twitter:site" content="@lbryio">
|
||||
<meta name="twitter:creator" content="@lbryio">
|
||||
|
||||
<!-- Open Graph data -->
|
||||
<meta property="og:title" content="<?php echo $title ?>" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="og:image" content="<?php echo Response::getMetaImage() ?>" />
|
||||
<meta property="og:description" content="<?php echo Response::getMetaDescription() ?>"/>
|
||||
<meta property="og:site_name" content="LBRY" />
|
||||
|
||||
<base target="_parent" />
|
||||
</head>
|
||||
<body>
|
||||
<?php echo $content ?>
|
||||
<div class="hide">
|
||||
<div id="fb-root"></div>
|
||||
<div id="js">
|
||||
<?php foreach(Response::getJsAssets() as $src): ?>
|
||||
<script src="<?php echo $src ?>"></script>
|
||||
<?php endforeach ?>
|
||||
<script>
|
||||
(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)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-60403362-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) return;
|
||||
js = d.createElement(s); js.id = id;
|
||||
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'));
|
||||
|
||||
window.twttr = (function(d,s,id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0],
|
||||
t = window.twttr || {};
|
||||
if (d.getElementById(id)) return;
|
||||
js = d.createElement(s);
|
||||
js.id = id;
|
||||
js.src = "//platform.twitter.com/widgets.js";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
|
||||
t._e = [];
|
||||
t.ready = function(f) {
|
||||
t._e.push(f);
|
||||
};
|
||||
|
||||
return t;
|
||||
}(document, "script", "twitter-wjs"));
|
||||
</script>
|
||||
<script>
|
||||
<?php echo implode("\n", Response::getJsCalls()) ?>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -7,6 +7,7 @@
|
|||
<?php if ($error): ?>
|
||||
<div class="notice notice-error spacer1"><?php echo $error ?></div>
|
||||
<?php elseif ($success): ?>
|
||||
<?php echo View::render('analytics/subTwitter') ?>
|
||||
<div class="notice notice-success spacer1"><?php echo $success ?></div>
|
||||
<?php endif ?>
|
||||
<div class="mail-submit">
|
||||
|
|
Loading…
Add table
Reference in a new issue