Set up Google Analytics

This is for tracking how many people visit your website and where they're from.

Get your Google Tag. About Google Tag: https://developers.google.com/tag-platform/gtagjs

Insert this into "Lay Options" → "Custom <head> content"

Replace "GA_TRACKING_ID" with your tracking ID which looks like: "UA-X13XXX0XX-1"

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'GA_TRACKING_ID', {
        send_page_view: false
    });
</script>
<script>
    window.laytheme.on('newpageshown', function(){
        if( typeof gtag != 'undefined' ) {
            gtag('event', 'page_view', {
                page_title: document.title,
                page_location: window.location.href,
                page_path: window.location.pathname,
                send_to: 'GA_TRACKING_ID'
            })
        }
    })
</script>

Sending the "page_view" event manually when Lay Theme's "newpageshown" event is triggered makes sure Google gets all page views.