Solved

Google Analytics User Defined / Custom Variable not working

Posted on 2011-03-11
3
713 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
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…

751 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