Solved

Google Analytics User Defined / Custom Variable not working

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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

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.
There are many other benefits to creating an inbound marketing strategy. Let’s take a look at five of the biggest and how they'll affect your business.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
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.

627 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