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 7017667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:56:37+00:00 2026-05-27T22:56:37+00:00

My task is to track registered and guest users on my site. I use

  • 0

My task is to track registered and guest users on my site.

I use GA code from this question.

Problem, that in Custom Variables report i see incorrect information. For example, I have 700 unique visitors, but only 60 of them with “user type”.

Here is the screenshoot:
enter image description here

As I understand there should be 688 visits and 688 “User Type” visits. What’s wrong?

Here is my Djano code:

 <script type="text/javascript">    
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', '{{ GOOGLE_ANALYTICS_KEY }}']);
  _gaq.push(['_setDomainName', '.site.com']);
  _gaq.push(['_trackPageview']);
  _gaq.push(['_trackPageLoadTime']);
  _gaq.push(['_setCustomVar',
      1,
      'User Type',
      {% if user.is_authenticated %}'Registered User'{% else %}'Guest'{% endif %},
      2
   ]);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

Thank you in advance.

  • 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-05-27T22:56:37+00:00Added an answer on May 27, 2026 at 10:56 pm

    You need to set your _setCustomVar before your _trackPageview. Otherwise, the custom variable data doesn’t bind (ie, gets sent in the __utm.gif hit and stored in cookies), and custom variable isn’t tracked.

    The 10% of visits that are showing custom variables are likely from pages on which there were other hits (events, ecommerce, etc.) that did carry the custom variable data. If you move the _setCustomVar to be before _trackPageview (but after _setDomainName), it should track 100%.

      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', '{{ GOOGLE_ANALYTICS_KEY }}']);
      _gaq.push(['_setDomainName', '.site.com']);
      _gaq.push(['_setCustomVar',
          1,
          'User Type',
          {% if user.is_authenticated %}'Registered User'{% else %}'Guest'{% endif %},
          2
       ]);
      _gaq.push(['_trackPageview']);
      _gaq.push(['_trackPageLoadTime']);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Would anyone happen to know a trick that will keep this MSBuild task from
I'm receiving errors from Gtk that I can't track down. Every time my mouse
This isn't homework for me , it's a task given to students from some
I am writing an application that keeps track of content pushed around between users
My task is to track adding and deleting disk drives from windows service. I
Take my profile for example, or any question number of views on this site,
Task at hand — I have three versions of some code, developed by different
This task was actually given to us as homework, but the requirement in the
is there any way to intercept calendar task,meetings. Means track task and meeting on
I just checked my Chromium task manager and noticed that my Goats Teleported count

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.