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
|
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()
|
public static function init()
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ class MailActions extends Actions
|
||||||
if ($success)
|
if ($success)
|
||||||
{
|
{
|
||||||
Session::set(Session::KEY_MAILCHIMP_LIST_IDS, array_merge(Session::get(Session::KEY_MAILCHIMP_LIST_IDS, []), [$mcListId]));
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -48,9 +48,9 @@ class MailActions extends Actions
|
||||||
{
|
{
|
||||||
$vars += ['btnClass' => 'btn-primary', 'returnUrl' => $_SERVER['REQUEST_URI']];
|
$vars += ['btnClass' => 'btn-primary', 'returnUrl' => $_SERVER['REQUEST_URI']];
|
||||||
$vars['error'] = Session::get('list_error');
|
$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_error');
|
||||||
Session::unsetKey('list_success');
|
Session::unsetKey(Session::KEY_LIST_SUB_SUCCESS);
|
||||||
return $vars;
|
return $vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,13 @@ class Response
|
||||||
protected static $metaDescription = '',
|
protected static $metaDescription = '',
|
||||||
$metaTitle = '',
|
$metaTitle = '',
|
||||||
$jsCalls = [],
|
$jsCalls = [],
|
||||||
|
$assets = [
|
||||||
|
'js' => [
|
||||||
|
'/js/jquery-2.1.3.min.js',
|
||||||
|
'/js/global.js'
|
||||||
|
],
|
||||||
|
'css' => []
|
||||||
|
],
|
||||||
// $bodyCssClasses = [],
|
// $bodyCssClasses = [],
|
||||||
$metaImg = '';
|
$metaImg = '';
|
||||||
|
|
||||||
|
@ -71,6 +78,16 @@ class Response
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function addJsAsset($src)
|
||||||
|
{
|
||||||
|
static::$assets['js'][] = $src;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getJsAssets()
|
||||||
|
{
|
||||||
|
return static::$assets['js'];
|
||||||
|
}
|
||||||
|
|
||||||
// public static function addBodyCssClass($classOrClasses)
|
// public static function addBodyCssClass($classOrClasses)
|
||||||
// {
|
// {
|
||||||
// static::$bodyCssClasses = array_unique(array_merge(static::$bodyCssClasses, (array)$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>
|
|
@ -46,8 +46,9 @@
|
||||||
<div class="hide">
|
<div class="hide">
|
||||||
<div id="fb-root"></div>
|
<div id="fb-root"></div>
|
||||||
<div id="js">
|
<div id="js">
|
||||||
<script src="/js/jquery-2.1.3.min.js"></script>
|
<?php foreach(Response::getJsAssets() as $src): ?>
|
||||||
<script src="/js/global.js"></script>
|
<script src="<?php echo $src ?>"></script>
|
||||||
|
<?php endforeach ?>
|
||||||
<script>
|
<script>
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
(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),
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<?php if ($error): ?>
|
<?php if ($error): ?>
|
||||||
<div class="notice notice-error spacer1"><?php echo $error ?></div>
|
<div class="notice notice-error spacer1"><?php echo $error ?></div>
|
||||||
<?php elseif ($success): ?>
|
<?php elseif ($success): ?>
|
||||||
|
<?php echo View::render('analytics/subTwitter') ?>
|
||||||
<div class="notice notice-success spacer1"><?php echo $success ?></div>
|
<div class="notice notice-success spacer1"><?php echo $success ?></div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<div class="mail-submit">
|
<div class="mail-submit">
|
||||||
|
|
Loading…
Add table
Reference in a new issue