Support for auto download parameter, dynamic OS /get routes, fix for dev analytics

This commit is contained in:
Jeremy Kauffman 2017-12-14 14:02:19 -05:00
parent 74e0a9423b
commit b96d016977
5 changed files with 20 additions and 8 deletions

View file

@ -97,11 +97,10 @@ class Controller
$router->get(['/get', 'get'], 'DownloadActions::executeGet');
$router->get(['/getrubin', 'getrubin'], 'DownloadActions::executeGet');
$router->get(['/windows', 'get-windows'], 'DownloadActions::executeGet');
$router->get(['/linux', 'get-linux'], 'DownloadActions::executeGet');
$router->get(['/osx', 'get-osx'], 'DownloadActions::executeGet');
$router->get(['/android', 'get-android'], 'DownloadActions::executeGet');
$router->get(['/ios', 'get-ios'], 'DownloadActions::executeGet');
foreach(array_keys(OS::getAll()) as $os)
{
$router->get(['/' . $os, 'get-' . $os], 'DownloadActions::executeGet');
}
$router->get('/roadmap', 'ContentActions::executeRoadmap');
$router->post('/quickstart/auth', 'DeveloperActions::executeQuickstartAuth');

View file

@ -40,6 +40,7 @@ class DownloadActions extends Actions
'analyticsLabel' => $analyticsLabel,
'buttonLabel' => $buttonLabel,
'downloadUrl' => $asset ? $asset['browser_download_url'] : null,
'isAuto' => Request::getParam('auto'),
'os' => $os,
'osTitle' => $osTitle,
'osIcon' => $osIcon,

View file

@ -2,6 +2,9 @@
class OS
{
/*
* if changing below constants, you should add permanent redirects for old OS names used in URLs
*/
const OS_ANDROID = 'android',
OS_IOS = 'ios',
OS_LINUX = 'linux',
@ -32,7 +35,7 @@ class OS
case 'pkg':
return OS::OS_OSX;
case 'msi': // fallthrough
case 'Fmsi': // fallthrough
case 'exe':
return OS::OS_WINDOWS;

View file

@ -21,11 +21,19 @@
<a class="btn-alt btn-large"
download
href="<?php echo $downloadUrl ?>"
id="get-download-btn"
data-facebook-track="1"
data-analytics-category="Sign Up"
data-analytics-action="Download"
data-analytics-label="<?php echo $analyticsLabel ?>"
><?php echo $buttonLabel ?></a>
<?php if ($isAuto): ?>
<?php js_start() ?>
var anchor = document.getElementById('get-download-btn');
ga('send', 'event', anchor.getAttribute('data-analytics-category'), anchor.getAttribute('data-analytics-action'), anchor.getAttribute('data-analytics-label'));
setTimeout(function() { window.location = anchor.getAttribute('href'); }, 500);
<?php js_end() ?>
<?php endif ?>
<br/>
<span class="meta">
<?php echo $version ?>,

View file

@ -24,7 +24,8 @@
</script>
<?php else: ?>
<?php js_start() ?>
<script>
window.ga = function() { };
console.log('Analytics partial skipped because this is a non-production instance.');
<?php js_end() ?>
</script>
<?php endif ?>