Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:14:32+00:00 2026-06-07T17:14:32+00:00

I have the following code: var selectedLevel = true; if (selectedLevel === true) {

  • 0

I have the following code:

var selectedLevel = true;
if (selectedLevel === true) {
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

    try {
        var pageTracker = _gat._getTracker("UA-XXXXXXX-XX"); // <-- The ID _is_ here
        pageTracker._trackPageview();
    } catch(err) {}
}

I am expecting to see cookies being set in FireCookie but I see nothing. The ga.js does appear to be loading in though, according to my Firebug NET tab.

Is there a reason anybody knows of why the cookies wouldn’t be getting set?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:14:33+00:00Added an answer on June 7, 2026 at 5:14 pm

    I suspect that because the try/catch block is in the same script, the line getting the tracker is being executed before the other script loads and fails because _gat isn’t defined. Try putting it in its own script block like the Google docs suggest.

    <script type="text/javascript">
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
        try{ 
            var pageTracker = _gat._getTracker("UA-xxxxxx-x");
            pageTracker._trackPageview();
        } catch(err) {} 
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code var postData = ; var req = HttpWebRequest.Create(http://www.imageshack.us/upload_api.php); req.ContentType
I have the following code: var bool:String = true; Without an if block or
I have the following code: var tlp = new TableLayoutPanel { Location = new
I have the following JS: http://monobin.com/__m1c171c4e and the following code: Code: var tpl =
I have the following code var input = $('#el_id'); wrapper = $(document.createElement('div')); wrapper.addClass('small'); wrapper.css('width',200);
I have the following code: var images = document.getElementsByTagName('img'); if (screen.width > 640) {
I have the following code: var tempIdx = document.getElementById('cityBuild').selectedIndex; var tempBuilding = document.getElementById('cityBuild').options[tempIdx].value; //
I have the following code: var id1=Times+another_variable; alert(document.getElementById(id1).className); Basically, I need to pass a
I have the following code var email = document.getElementById(email).value; $.post(/valid,{emailadd: email},function(data){ alert(data); }); on
I have the following code: var d = document.createElement(div); d.id = d_1; d.style.backgroundImage =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.