mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-28 16:01:26 +00:00
turn off analytics on staging
This commit is contained in:
parent
afd4786f73
commit
f2e7c55600
5 changed files with 40 additions and 66 deletions
25
view/analytics/track.php
Normal file
25
view/analytics/track.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php if (IS_PRODUCTION): ?>
|
||||||
|
<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)
|
||||||
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
|
ga('create', 'UA-60403362-1', 'auto');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
|
||||||
|
<?php //we load fb sdk elsewhere, events loaded below (do we need both??) ?>
|
||||||
|
|
||||||
|
!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');
|
||||||
|
|
||||||
|
<?php //and now everyone knows what happens on our website except us ?>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<?php endif ?>
|
|
@ -48,61 +48,17 @@
|
||||||
<div class="hide">
|
<div class="hide">
|
||||||
<div id="fb-root"></div>
|
<div id="fb-root"></div>
|
||||||
<div id="js">
|
<div id="js">
|
||||||
<?php Response::addJsAsset('//platform.twitter.com/oct.js') ?>
|
<script id="facebook-jssdk" src="//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1477813539180850"></script>
|
||||||
|
<script id="twitter-oct" src="//platform.twitter.com/oct.js"></script>
|
||||||
|
<script id="twitter-wjs" src="//platform.twitter.com/widgets.js"></script>
|
||||||
<?php foreach(Response::getJsAssets() as $src): ?>
|
<?php foreach(Response::getJsAssets() as $src): ?>
|
||||||
<script src="<?php echo $src ?>"></script>
|
<script src="<?php echo $src ?>"></script>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<script>
|
<?php echo View::render('analytics/track') ?>
|
||||||
<?php //google analytics ?>
|
<?php $js = Response::getJsCalls() ?>
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
<?php if ($js): ?>
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
<script><?php echo implode("\n", $js) ?></script>
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
<?php endif ?>
|
||||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
||||||
|
|
||||||
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;
|
|
||||||
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'));
|
|
||||||
|
|
||||||
!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');
|
|
||||||
|
|
||||||
<?php //twitter ?>
|
|
||||||
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"));
|
|
||||||
|
|
||||||
<?php //and now everyone knows what happens on our website except us ?>
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
<?php echo implode("\n", Response::getJsCalls()) ?>
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
include $_SERVER['ROOT_DIR'] . '/autoload.php';
|
include $_SERVER['ROOT_DIR'] . '/autoload.php';
|
||||||
|
|
||||||
|
define('IS_PRODUCTION', $_SERVER['SERVER_NAME'] == 'lbry.io');
|
||||||
|
|
||||||
i18n::register();
|
i18n::register();
|
||||||
Session::init();
|
Session::init();
|
||||||
Controller::dispatch(strtok($_SERVER['REQUEST_URI'], '?'));
|
Controller::dispatch(strtok($_SERVER['REQUEST_URI'], '?'));
|
|
@ -30,12 +30,10 @@ $(document).ready(function() {
|
||||||
labelCycles = body.find('.label-cycle'); //should use better pattern but we have so little JS right now
|
labelCycles = body.find('.label-cycle'); //should use better pattern but we have so little JS right now
|
||||||
|
|
||||||
body.on('click', 'a', onAnchorClick);
|
body.on('click', 'a', onAnchorClick);
|
||||||
|
|
||||||
if (window.twttr)
|
if (window.twttr)
|
||||||
{
|
{
|
||||||
twttr.ready(function (twttr) {
|
twttr.events.bind('follow', onTwitterFollow);
|
||||||
twttr.events.bind('follow', onTwitterFollow);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.fbAsyncInit = function()
|
window.fbAsyncInit = function()
|
||||||
|
@ -120,12 +118,13 @@ $(document).ready(function() {
|
||||||
|
|
||||||
function onTwitterFollow (intentEvent)
|
function onTwitterFollow (intentEvent)
|
||||||
{
|
{
|
||||||
if (!intentEvent) return;
|
if (!intentEvent || !ga) return;
|
||||||
ga('send', 'social', 'Twitter', 'follow', window.location.href);
|
ga('send', 'social', 'Twitter', 'follow', window.location.href);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFacebookLike(url)
|
function onFacebookLike()
|
||||||
{
|
{
|
||||||
|
if (!ga) return;
|
||||||
ga('send', 'social', 'Facebook', 'like', window.location.href);
|
ga('send', 'social', 'Facebook', 'like', window.location.href);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
alert('omg');
|
|
||||||
$('.infobar').after('
|
|
||||||
<div style="margin-bottom: 20px"><a href="file:///C:/ItsAWonderfulLive.mp4" style="
|
|
||||||
color: white; background-color: #104639; background-image: -webkit-linear-gradient(top, #1a705b, #104639); background-image: -moz-linear-gradient(top, #1a705b, #104639); background-image: -ms-linear-gradient(top, #1a705b, #104639); background-image: linear-gradient(top, #1a705b, #104639); background-color: #155B4A; border: 1px solid black;
|
|
||||||
cursor: pointer; display: inline-block;
|
|
||||||
height: 24px;
|
|
||||||
line-height: 24px; padding: 0 15px; text-decoration: none;
|
|
||||||
">Watch on LBRY</a></div>');
|
|
Loading…
Add table
Reference in a new issue