Help with adding Google Analytics to new site

acidrain

Executive Member
Joined
Jan 7, 2007
Messages
6,966
Reaction score
1,765
Location
At a computer
Hi Guys,

I'm having some problems adding my GA script to my website.

Let me first begin by saying that I am not a web dev, so if you can keep the talk simple I would really appreciate it :P

Anyhoo, it's a flash site using xml files for each page. How would one go about inserting the analytic script?

If any more info is required, just shout and I will try give it.
 
You should have a html file. which contains the flash?
Script should go in this file
 
You should have a html file. which contains the flash?
Script should go in this file

My index.html has the script just before the </head> but google is still saying that tracking is not installed.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>**********</title>
<meta name="keywords" content=" " />
<meta name="description" content=" " />
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/swfaddress.js"></script>
<script type="text/javascript" src="js/swffit.js"></script>
<script type="text/javascript">
	var flashvars = {
		configXML: "xml/layout2/config.xml",
		killCache: "false",
		cachePeriod: "second" // possible values: "second", "minute", "hour" or "day"
	};
	var params = {
		quality: "high",
		wmode: "window",
		devicefont: "false",
		allowscriptaccess: "always",
		bgcolor: "#ffffff",
		allowFullScreen: "true",
		scale: "noScale", 
		salign: "lt", 
		menu: "false"
	};
	var attributes = {
		id: "flash",
		name: "flash"
	};
	swfobject.embedSWF("index.swf", "flashcontent", "100%", "100%", "10.0.0", "js/expressinstall.swf", flashvars, params, attributes);
	swffit.fit("flash", 1000, 700);
</script>

<style type="text/css" media="screen">
      html, body { width:100%; height:100%; margin:0; padding:0; }
	  object { outline:none; }
</style>
[b]<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-*******', 'auto');
  ga('send', 'pageview');

</script>
[/b]
</head>

<body bgcolor="#ffffff">
<div id="flashcontent">
	<a href="http://www.adobe.com/go/getflashplayer/"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a>
</div>
</body>
</html>
 
If you are using google chrome load the web page, right click select inspect element .
In the bar that opens up in the bottom, click on console , f5 (reload page ) , check if there any error in posted in console
 
If you are using google chrome load the web page, right click select inspect element .
In the bar that opens up in the bottom, click on console , f5 (reload page ) , check if there any error in posted in console

Can't inspect element, only options that pop up are the flash options.
 
Have you tried adding the Analytics code inside the XML using the following code:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<script type="text/javascript">
<![CDATA[
  //javascript
]]>
</script>

If the code is added inside the Head section, it should work. I had a similar problem about 2 months ago, it took Analytics about 24 hours before it showed that it picked up the code.
 
Have you tried adding the Analytics code inside the XML using the following code:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<script type="text/javascript">
<=!=[=C=D=A=T=A=[
  //javascript
]=]=>
</script>

If the code is added inside the Head section, it should work. I had a similar problem about 2 months ago, it took Analytics about 24 hours before it showed that it picked up the code.

There is a tab for Real time in the Reporting section. That normally shows up instantly so he could try checking there.

I'm guessing this site isn't live for the rest of us to see?
 
Have you tried adding the Analytics code inside the XML using the following code:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<script type="text/javascript">
<![CDATA[
  //javascript
]]>
</script>

If the code is added inside the Head section, it should work. I had a similar problem about 2 months ago, it took Analytics about 24 hours before it showed that it picked up the code.

Thanks will try that. Will also revert back in 24hrs, maybe as you said it just takes time for it to kick in.

There is a tab for Real time in the Reporting section. That normally shows up instantly so he could try checking there.

I'm guessing this site isn't live for the rest of us to see?

Real time is showing activity when i browse but its not very informative for 1 and secondly it seems to only show / as the active page, even when i browse other pages

Also the site is live at the moment... www.verticallogic.co.za
 
Last edited:
Thanks will try that. Will also revert back in 24hrs, maybe as you said it just takes time for it to kick in.



Real time is showing activity when i browse but its not very informative for 1 and secondly it seems to only show / as the active page, even when i browse other pages

Also the site is live at the moment... www.verticallogic.co.za

I have checked the source code of your site, and I can see your Analytics code just before the closing Head tag, so it is fine and should work. Probably just takes a while for them to update.

Also, for purposes of better stats, I would rather have stuck the code in every XML file.
 
I have checked the source code of your site, and I can see your Analytics code just before the closing Head tag, so it is fine and should work. Probably just takes a while for them to update.

Also, for purposes of better stats, I would rather have stuck the code in every XML file.
Thanks I originally inserted into every xml but still said not installed. As you said though it might take a while for them to update so I will re-add it and just wait and see if it updates

Edit: Just a quick question though, the code asks to be inserted within the head segment yet the xml files don't have it. Does it matter?
 
Last edited:
Just an update: GA is showing as receiving data now so probably was just a delay, although now the trick is trying to get behaviour ( more specifically pages viewed ) to work as it's only showing "/" as the only content being viewed
 
Thanks I originally inserted into every xml but still said not installed. As you said though it might take a while for them to update so I will re-add it and just wait and see if it updates

Edit: Just a quick question though, the code asks to be inserted within the head segment yet the xml files don't have it. Does it matter?

No, it should not matter in the XML files.

Try it and see. That is the only way you will be able to get comprehensive stats on all your different pages and sections of your website.
 
Just an update: GA is showing as receiving data now so probably was just a delay, although now the trick is trying to get behaviour ( more specifically pages viewed ) to work as it's only showing "/" as the only content being viewed

Yep, like I said, I also had a delay of about a day, perhaps longer. Something is probably not working 100% on their new system, but at least it is working now.
 
Thanks all for the assistance.

If i have anymore issues I'll be sure to return and seek your wise council :D
 
Top
Sign up to the MyBroadband newsletter
X