Commit a7255c49 authored by Andrew Sliwinski's avatar Andrew Sliwinski

Add GA tracking and optimize open graph tags

parent 03b3ae83
module.exports = {
// Search and metadata
title: 'Imagine, Program, Share',
description:
'Scratch is a free programming language and online community ' +
'where you can create your own interactive stories, games, ' +
'and animations.',
// Open graph
og_image: 'https://scratch.mit.edu/images/og_image.jpg',
og_image_type: 'image/jpeg',
og_image_width: 986,
og_image_height: 860,
// Analytics & Monitoring
ga_tracker: process.env.GA_TRACKER || ''
};
{
"title": "Imagine, Program, Share",
"description": "Scratch is a free programming language and online community where you can create your own interactive stories, games, and animations."
}
...@@ -4,12 +4,14 @@ var fs = require('fs'); ...@@ -4,12 +4,14 @@ var fs = require('fs');
var mustache = require('mustache'); var mustache = require('mustache');
var path = require('path'); var path = require('path');
var config = require('./config');
/** /**
* Constructor * Constructor
*/ */
function Handler (route) { function Handler (route) {
// Route definition // Route definition
defaults(route, require('./defaults.json')); defaults(route, config);
// Render template // Render template
var location = path.resolve(__dirname, './template.html'); var location = path.resolve(__dirname, './template.html');
......
...@@ -10,13 +10,19 @@ ...@@ -10,13 +10,19 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Scratch - {{title}}</title> <title>Scratch - {{title}}</title>
<!-- Search & Open Graph-->
<meta name="description" content="{{description}}" /> <meta name="description" content="{{description}}" />
<meta name="google-site-verification" content="m_3TAXDreGTFyoYnEmU9mcKB4Xtw5mw6yRkuJtXRKxM" />
<!-- Open Graph -->
<meta property="og:type" content="website" />
<meta property="og:url" content="https://scratch.mit.edu/" /> <meta property="og:url" content="https://scratch.mit.edu/" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Scratch - {{title}}" /> <meta property="og:title" content="Scratch - {{title}}" />
<meta property="og:description" content="Make games, stories and interactive art with Scratch. (scratch.mit.edu)" /> <meta property="og:description" content="{{description}}" />
<meta property="og:image" content="{{&og_image}}" />
<meta property="og:image:type" content="{{&og_image_type}}" />
<meta property="og:image:width" content="{{&og_image_width}}" />
<meta property="og:image:height" content="{{&og_image_height}}" />
<!-- Favicon & CSS normalize --> <!-- Favicon & CSS normalize -->
<link rel="shortcut icon" href="/favicon.ico" /> <link rel="shortcut icon" href="/favicon.ico" />
...@@ -41,8 +47,19 @@ ...@@ -41,8 +47,19 @@
<script src="/js/main.bundle.js"></script> <script src="/js/main.bundle.js"></script>
<script src="/js/{{view}}.bundle.js"></script> <script src="/js/{{view}}.bundle.js"></script>
<!-- @todo Analytics (GA) --> <!-- Analytics (GA) -->
<!-- @todo Monitoring (Raven) --> <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', '{{&ga_tracker}}', {
'sampleRate': 10
});
ga('send', 'pageview');
</script>
<!-- @todo New Relic --> <!-- @todo New Relic -->
</body> </body>
</html> </html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment