Why isn´t my Google analytics code being detected? - asp-classic

I paste the code just before in every webpage and it doesn´t work.
Can somebody check why?
My website is http://www.agriculturacanaria.com
It has html, asp and css files. I didn´t touch the css but the code is already in all the head section of both the two others.

I don't know if that's valid GOogle Analytics cdode. It may be an old way or something, but the modern code looks something like this:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
(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>
You can probably use that code block and put in your own UA code and get it to work.
Microsoft Word makes for a really bad HTML editor, so you may want to find an alternative that allows for greater flexibility over the code and less bloat of the HTML. (You're probably being penalized for a tactic called "keyword stuffing" alone.)
Hope this helps!

Related

Link multiple Google webmaster tools accounts to single Analytics property

I tried to look for a good solution but couldn't find any.
I try to link multiple Google webmaster tools accounts to a single Analytics property.
I tried creating multiple views, but it seems you can't link it to a view.
I found a solution to add multiple domains to a Google Analytics property, but this seems outdated since Universal tracking
Note: probably some people might say I should 301 redirect the domains for duplicate content. But they are regionaly implemented using the hreflang alternate method which should be just fine.
You can link multiple Google Analytics accounts.
<script type="text/javascript">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
// Second tracker
_gaq.push(['secondTracker._setAccount','UA-YYYYYYYY-Y']);
_gaq.push(['secondTracker._trackPageview']);
(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>
See: http://seo-website-designer.com/Google-Analytics-Tracking-Multiple-Accounts

shorten Google Analytics code

Can the following line in Google Analytics code:
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
be shortened to
ga.src = '//stats.g.doubleclick.net/dc.js';
?
The full script looks like this:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_setDomainName', 'example.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
It's called a Protocol Relative URL and using one to shorten the Google Analytics code can cause some problems with IE6.
From Paul Irish # Google on using Protocol-Relative URLs:
There is an edgecase bug in IE6 that causes a dialog to blow up… under some security settings from the non-‘ssl’ subdomain. So feel free to take 40 bytes off your GA snippet if you don’t care about IE6.. otherwise you’re gonna need that ternary operator. :)
If you do so it won't work if you load this file using the file: protocol to test your server for example. Besides that small problem it should work just fine.

Google Analytics code always reports page name as being "$A"

I have some code (below) that I'm using to track pageviews on Google Analytics. In Google Analytics, all pages end up having the name "$A".
I can't seem to find anyone who has had the same issue and I can't see what I'm doing wrong:
<script type="text/javascript">
(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);
})();
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_trackPageview']);
</script>
<script src="/__utm.js" type="text/javascript"></script>
It sounds like, rather than there being a problem with the tracking code, that the problem is actually with a filter configured for your account.
Specifically, $A makes it sound like you have an improperly configured Reyes based filter that, rather than outputting the regex match, is instead outputting the string "$A", which is meaningless unless you're properly using RegEx.
Can you post detailed information about the profile? In any case, you shouldn.t be filtering on a main profile, since filters cannot be undone, so any configuration errors on your main profile will result in permanently lost data.
My recommendation is to totally remove the filters in pladce, duplicate the profile and apply your desired filters against the duplicate, to mitigate potential data loss problems like this.

Google Analytics reports to be receiving data, but none is showing up

Hi recently redesigned my site (http://bit.ly/gwrYwb) which was formerly tracking pageviews properly via Google Analytics. After the redesign, I inserted the exact same code right before the </head> tag:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
(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>
(The UA number is correct on the actual page.) However, GA is mysteriously reporting zero pageviews/visits, even though it claims to be receiving data. Has anyone experienced a problem like this before? The only other JS I'm using is including jQuery, as well as a widely-used jQuery plugin on one of my pages.
This is kind of lame, but have you checked your profile filters? You might still have old filters (for the former website) applied that filter all urls out.
We had this problem with another website and were debugging for weeks until we found this simple solution...

Analytics - Email tracking

I'm trying to track my email links with Google Analytics, but for some reasons it does not work.
Here is my code:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'xxxxxx']);
_gaq.push(['_trackPageview']);
(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>
and here's the onClick function in page source code:
mail#mail.sk
I tried same tracking for link on other page and it worked. After I installed GA Debug, I found out that when I'm tracking mailto link, error shows up - Failed to load resource: mailto:mail#mail.sk
Does somebody have any ideas why there is an error and how to fix it?
Thanks
Wild guess :
Does adding javascript: before the content of your onClick even solves it ?
mail#mail.sk
I am assuming these links will be visible in email clients such as outlook and Gmail. Most, if not all, email clients strip all JavaScript out of email messages before displaying them.
If you would like to track email opens and other such information your only option is to use pixel tracking methods.

Resources