﻿    function criarScriptAnalytics(){
        var contaGa;
        var locationName = document.domain;

        /*if (locationName.indexOf('extra.com.br') > 0) {
            contaGa = 'UA-1582435-1';
        } else if (locationName.indexOf('lojahp.com.br') > 0) {
            contaGa = 'UA-15962031-1';
        } else*/ if (locationName.indexOf('pontofrio.com.br') > 0) {
            contaGa = 'UA-1184279-1';
        }

        if (contaGa.length > 0)
        {
            // Script Google
            document.write('<!-- START GOOGLE ANALYTICS -->');
            //document.write('<script type="text/javascript">');
            //document.write('<![CDATA[ *');
            //document.write('var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");');
            document.write(unescape('%3Cscript src="http://www.google-analytics.com/ga.js" type="text/javascript"%3E%3C/script%3E'));
            //document.write('/* ]]> */');
            //document.write('</script>');
            document.write('<script type="text/javascript">');
            //document.write('/* <![CDATA[ */');
            document.write('try{');
            document.write('var pageTracker = _gat._getTracker("' + contaGa + '");');
            document.write('pageTracker._trackPageview("/erro404?page=' + document.location.pathname + document.location.search + '&from=' + document.referrer + '");');

            if (GetCookie('TesteAB') != null)
                document.write('pageTracker._setVar("' + GetCookie('TesteAB') + '");');

            document.write('}catch(err){}');
            //document.write('/* ]]> */');
            document.write('</script>');
            document.write('<!-- END GOOGLE ANALYTICS -->');
        }

        document.write('<!-- START COREMETRICS --> ');
        document.write(unescape('%3Cscript src="../Js/metrics.js" type="text/javascript"%3E%3C/script%3E'));
        document.write('<script type="text/javascript">');
        //document.write('/* <![CDATA[ */');
        document.write('cmCreateErrorTag("' + document.title + '","ERRO");');
        //document.write('/* ]]> */');
        //document.write('</script> ');
        document.write('<!-- END COREMETRICS -->');
    }

    function GetCookie(cookieName) { var a_all_cookies = document.cookie.split(';'); var a_temp_cookie = ''; var cookie_name = ''; var cookie_value = ''; var b_cookie_found = false; for (i = 0; i < a_all_cookies.length; i++) { a_temp_cookie = a_all_cookies[i].split('='); cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, ''); if (cookie_name == cookieName) { b_cookie_found = true; if (a_temp_cookie.length > 1) { cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, '')); }; return cookie_value; break; }; a_temp_cookie = null; cookie_name = ''; }; if (!b_cookie_found) { return null; } };
