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

  • SEARCH
  • Home
  • 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 8622235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:00:11+00:00 2026-06-12T07:00:11+00:00

I want to call the following code from my pages, and sometimes pass a

  • 0

I want to call the following code from my pages, and sometimes pass a PageName parameter.

function _ga(PageName) {
    _gaq = [['_setAccount', 'UA-00000000-0'], ['_setDetectFlash', false], ['_trackPageview', PageName]];//global variable
    var d = document,
        t = 'script',
        g = d.createElement(t),
        s = d.getElementsByTagName(t)[0];
    g.src = 'https://ssl.google-analytics.com/ga.js';
    s.parentNode.insertBefore(g, s);
}

What will happen if the PageName variable is undefined? Would Analytics interpret it as ['_trackPageview'].

I cannot test it live, but as far as i can see nothing crashes when the variable is undefined.

I can add extra code if Analytics does not accept undefined.

  • 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-12T07:00:13+00:00Added an answer on June 12, 2026 at 7:00 am

    Yes. The following 3 calls are equivalent.

    _gaq.push(['_trackPageview']);
    _gaq.push(['_trackPageview', undefined]);
    _gaq.push(['_trackPageview', '']);
    

    You can easily test this by executing the 3 calls in any site that uses Google Analytics (Including Stack Exchange) and then examining the gif requests on the network panel.

    You will notice that all the calls will use the current url by default by examining the utmp parameter of the gif request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to call the Sleep function on ASM. So I wrote the following:
I have the following views in my application. Basically I want to call show_house()
I want to call a method say success(message) of javascript from android activity. I
I want to call a function a number of times providing it with different
I'm having problems trying to call a Javascript function from an enqueued javascript file
In my following code, I am calling function Make Request that is located in
I have user-extensions.js that contain the following code of snippet: Selenium.prototype.doTypeRepeated = function(locator, text)
In the following code I want to reduce these 5 functions down to 3.
I have the following code: function menu($parent, $level){ global $dbc; $result = $dbc->prepare('SELECT linktext,
I have the following code: (function(){ var DS = (function(){ DS.prototype.queryDB = function() {

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.