Solved

Google Analytics User Defined / Custom Variable not working

Posted on 2011-03-11
3
710 Views
Last Modified: 2013-12-07
Hi Experts,

I have installed this tracking code. I would like to track if the page being viewed by the user is private or a public page.

This is my code below.

If the page is public, public is assigned where the word 'public' is currently being shown, if it is private, then private is assigned instead.

When I log into my analytic account the user defined variable only has 'not set' - I cannot see wither public or private there?

I have set this up over 24 hours ago so don't think it's a delay problem.

Is there something wrong with this code?

It is placed as the last part of the head before </head>

Thanks
<script type="text/javascript">

		  var _gaq = _gaq || [];
		  _gaq.push(['_setAccount', 'UA-MY-CODE-IVE-CHANGED']);
		  _gaq.push(['_trackPageview']);
		  _gaq.push(['_setCustomVar', 1,'Page Type', 'public', 3]);
		  
		  		  (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>

Open in new window

0
Comment
Question by:bigMlittleC
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
gwkg earned 500 total points
ID: 35144183
Try setting the custom var before trackPageview
0
 

Author Comment

by:bigMlittleC
ID: 35146019
Thanks, I will give that a try. It can take a while for the results to show (24hours+). Bare with me. If it works I shall be awarding you the points!
0
 

Author Closing Comment

by:bigMlittleC
ID: 35164272
Sorry for the delay.

Many thanks. It is now picking up the variables.

All the best
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Starting your own business is always a daunting process, and for most people it is brand new experience. Avoid the common pitfalls by following these tips to start on the road to success.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question