Solved

Google Analytics User Defined / Custom Variable not working

Posted on 2011-03-11
3
707 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Find out what you should include to make the best professional email signature for your organization.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now