<% var title = "" %> 
<% if(page.canonical_path == 'index.html') {  %>
    <% title = "Landing Page view" %>
<% } else { %> 
    <% if(page != undefined) { %>
        <% if(page.content_type != undefined) { %>
            <% title = page.content_type.charAt(0).toUpperCase() + page.content_type.slice(1); %>
        <% } else if (page.title != undefined) { %>
            <% title = page.title.charAt(0).toUpperCase() + page.title.slice(1); %>
        <% } else { %>
            <% title = "Page"; %>
        <% } %>
    <% } else { %>
        <% title = "Page"; %>
    <% } %>
<% } %>

<% if(page.content == undefined) { %>
    <script>
        if (location.hostname !== "localhost" && location.hostname !== "127.0.0.1"){
            mixpanel.track("<%- title %>");
        } else {
            console.log('No tracking in ' + location.hostname);
            console.log(`Tracking: \'<%- title %>\'`)
    }
    </script>
<% } else { %>
    <script>
        var payload = { content : "<%- page.title %>" };
        if (location.hostname !== "localhost" && location.hostname !== "127.0.0.1"){
            mixpanel.track("<%- title %> view", payload);
        } else {
            console.log('No tracking in ' + location.hostname);
            console.log(`Tracking: \'<%- title %> view\'`, payload)
    }
    </script>
<% } %>