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:

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=""></script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'GA_TRACKING_ID', {
        send_page_view: false
    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'

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