ga_default = function (_id) {
    /* GA default */
    window.dataLayer = window.dataLayer || [];

    function gtag() {
        dataLayer.push(arguments);
    }
    gtag('js', new Date());

    gtag('config', _id, {
        'send_page_view': false
    });

    function gtag_pageView(_key, args = {}) {
        //ga('send', 'pageview', key);
        gtag('event', 'page_view', {
            'page_title' : document.title,
            'page_path': '/' + _key,
            ...args,
        });
        console.log("pageView: " + _key + 'args: ' + JSON.stringify(args));
    }

    function gtag_ButtonClick(_name, _key) {
        //ga('send', 'event', 'Button', 'Click', key);
        gtag('event', 'click', {
            'event_category': _name,
            'event_label': _key
        });

        console.log(_name + "-Click: " + _key);
    }
    function gtag_Event(_name, _key) {
        //ga('send', 'event', 'Button', 'Click', key);
        gtag('event', 'Video', {
            'event_category': _name,
            'event_label': _key
        });

        console.log(_name + ":" + _key);
    }
    /* GA default */

    function page() {

    }

    /* Demo : data-category="footer" data-ga="privacy" */
    function page_ga() {
        $(document).on("click", "*[data-ga]", function () {
            gtag_ButtonClick($(this).data("category"), $(this).data("ga"));
        });
    }

    function init() {
        page();
        page_ga()
    } {
        init();
    }
    return {
        pageView: function (_key, args = {}) {
            gtag_pageView(_key, args)
        },
        ButtonClick: function (_name, _key) {
            gtag_ButtonClick(_name, _key)
        },
        Event: function (_name, _key) {
            gtag_Event(_name, _key)
        },
    };
}

var setGA = new ga_default("G-WM72ZTPQGL");