<commit_before>'use strict';
/*global ga, $ */

var uaTrackingJS = function(trackingJSOptions, trackingJSHelper) {
    /**
     * initialize
     */
    this.init = function (namespace, code, url) {
        var uaConfig = $.extend({
            allowLinker: false,
            linkerDomains: false
        }, trackingJSOptions.uaConfig);

        this.namespace = namespace;

        var options = {
            name: namespace
        };

        if (!!uaConfig.allowLinker) {
            options.allowLinker = uaConfig.allowLinker;
        }

        ga('create', code, url, options);

        if(trackingJSOptions.anonymizeIp === true) {
            trackingJSHelper.info(options.name + ' ip is anonymous');
            ga(namespace + '.set', 'anonymizeIp', true);
        } else {
            trackingJSHelper.info(options.name + ' ip is not anonymous');
        }

        if (!!uaConfig.allowLinker) {
            ga(this.namespace + '.require', 'linker');

            if (!!uaConfig.linkerDomains) {
                ga(this.namespace + '.linker:autoLink', uaConfig.linkerDomains);
            }
        }

    }.bind(this);

    /**
     * includes the ua analytics js
     */
    this.appendAnalyticsJs = function () {
        /* jshint ignore:start */
        (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'); 
        /* jshint ignore:end */
    };
};

/**
 * uaTrackingJS
 *
 * @param page
 * @param title<commit_msg>added check to run google analytics script only once<commit_after>'use strict';
/*global ga, $ */

var uaTrackingJS = function(trackingJSOptions, trackingJSHelper) {
    /**
     * initialize
     */
    this.init = function (namespace, code, url) {
        var uaConfig = $.extend({
            allowLinker: false,
            linkerDomains: false
        }, trackingJSOptions.uaConfig);

        this.namespace = namespace;

        var options = {
            name: namespace
        };

        if (!!uaConfig.allowLinker) {
            options.allowLinker = uaConfig.allowLinker;
        }

        ga('create', code, url, options);

        if(trackingJSOptions.anonymizeIp === true) {
            trackingJSHelper.info(options.name + ' ip is anonymous');
            ga(namespace + '.set', 'anonymizeIp', true);
        } else {
            trackingJSHelper.info(options.name + ' ip is not anonymous');
        }

        if (!!uaConfig.allowLinker) {
            ga(this.namespace + '.require', 'linker');

            if (!!uaConfig.linkerDomains) {
                ga(this.namespace + '.linker:autoLink', uaConfig.linkerDomains);
            }
        }

    }.bind(this);

    /**
     * includes the ua analytics js
     */
    this.appendAnalyticsJs = function () {
        if (typeof(ga) === 'undefined') {
            /* jshint ignore:start */
            (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');
            /* jshint ignore:end */
        }
    };
};

/**
 * uaTrackingJS
 *
 * @param page
 * @param title
{'fraction_non_alphanumeric': 0.1606842400448682, 'fraction_numerical': 0.0016825574873808188, 'mean_word_length': 2.1455026455026456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4784957', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1124, 'n_words': 178}