google analytic track sub domain error - joomla

I have two different joomla website in different folder with different sub domain.
for example,
public_html/chinese
and
public_html/english
domain preview
http://chinese.mydomain.com
and
http://english.mydomain.com
I wish to track these two websites separately in google analytic. As usual I created an account at first, and create two web property to serve both website.
The two web property details as below
Property ID: UA-XXXXXXX-1
Default URL: http://chinese.mydomain.com
tracking code
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-1']);
_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
Property ID: UA-XXXXXXX-2
Default URL: http://english.mydomain.com
tracking code
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-2']);
_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>
both of the sites show "Status: Tracking Not Installed". I am totally confused and there isn't any clue whats going on.
Durin debugging after the last line of the code appears the following message
Given URL is not allowed by the Application configuration.: One or
more of the given URLs is not allowed by the App's settings. It must
match the Website URL or Canvas URL, or the domain must be a subdomain
of one of the App's domains.
I didn't install any GA code in my main domain www.mydomain.com because it just serve at redirect page to my sub domain. I hope this doesn't cause any problem.

You have gone about it in the wrong way, don't have two separate tracking codes, you need one.
Login to GA, then select on of the Accounts you have created, then Admin then you need to create 2 profiles, one for chinese. and one for english. You'll notice that you only have the one tracking code to then implement, and to review traffic for each site you simply need to click on the appropriate profile.
The way you have done it could potentially work without an issue, but you will be restricted in what you can do - and as I am taking it that this is localised versions of your site you don't want to be adding up in your head each time to find out the total visitors number.

Related

google +1 and prototype.js 1.6 "Uncaught TypeError: Function.prototype.apply: Arguments list has wrong type"

The google +1 button and prototype.js 1.6 library seems to have conflicts see http://jsfiddle.net/9EF9N/
<div class="g-plusone" data-annotation="inline" data-width="300"></div>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
If you switch to prototype 1.7 everything works as expected.
I can't update the prototype library because it is in a complex application based on Magento 1.5.
Is there someone having the same problem and maybe could give me a solution?
Seems googel have changed something. It is now working again.

Joomla Multiple Domain names for one Joomla Install

I am using this article here to have two domains names point to the same Joomla install, with one having a different home page.
http://docs.joomla.org/Multiple_Domains_and_Web_Sites_in_a_single_Joomla!_installation
(option 2)
The sites open okay, and the second domain even goes to the correct landing page. The issue is that when on the second domain, all menu links open in a new window(they are relative links, but in the html it is adding "target=_blank") and i am not sure why, or how to stop it.
All the menu links properly open in the parent window when on the primary domain.
here are the two live links:
http://www.hustoninsurance.com/
http://tiffinhealthexchange.com/
Thanks in advance.
Running Joomla 3.0
I looked at the page source of tiffinhealth, and there is a function specialtrack() which is adding the target="_blank"
var specialtrack = new (function() {
[...]
var initialize = function() {
var links = document.links;
for (var i = 0, l = links.length; i < l; i++) {
var match = links[i].pathname.match(whitelist);
var match_links = links[i].href.match(domain);
var match_void = links[i].href.match('javascript:void');
if (typeof match_void == 'undefined' || match_void == null) {
if (typeof match !== 'undefined' && match !== null) {
links[i].addEventListener('click',trackpush_downloads,false);
links[i].setAttribute('target', '_blank');
}else if (typeof match_links == 'undefined' || match_links == null) {
links[i].addEventListener('click',trackpush_links,false);
links[i].setAttribute('target', '_blank');
}
}
}
};
The line links[i].setAttribute('target', '_blank'); is the one to blame for adding the target="_blank"; you should investigate with the developer or try to use an alternative solution to serve your purpose; maybe you could also avoid using two tracking on the same page.
Also, in your source you have plenty of absolute urls including the domain name: make sure this is consistent across the two domains otherwise page cache will eventually contain inconsistencies:
<a href="http://www.hustoninsurance.com/images/Showcases/Locations/99 Ashwood Rd/Group.png">
<img src="http://tiffinhealthexchange.com/images/Showcases/Locations/99 Ashwood Rd/Group.png" alt="Group.png"/></a>

jQuery address plugin, pathname change when using AJAX

I have a Wordpress blog at http://themes.visualise.ca/visualise and when a user clicks on a thumbnail the post is loaded with AJAX (using the jQuery address plugin) . I would like the URL to change at the same time to i.e. for the second thumbnail the url should change to http://themes.visualise.ca/visualise/portfolio/samuel but with the following code it changes to http://themes.visualise.ca/visualise/visualise/portfolio/samuel.
1) So my question is there a way to make the jQuery address replace the current pathname by the destination url's pathname instead of simply adding it at the end? I would like the solution to work also with http://themes.visualise.ca/ to http://themes.visualise.ca/visualise/portfolio/samuel because the blog might not be hosting in a folder like it is right now.
2) Or maybe there is another way to achieve this?
Here is the jQuery code:
$('.ajaxed,li.menu-item-object-page a').live('click', function(event) {
var link = $(this).attr('href');
var rewritepath = $(this)[0].pathname;
$("html,body").animate({scrollTop: 0}, 300);
$('#content,.plus').stop().fadeOut('slow', function(){
$('#board-wrapper').slideDown('slow');
$('#board').fadeOut('slow', function(){
$('#board').stop().load(link, function(){
$('#board').delay(1000).fadeIn('slow', function(){
var board_h2 = $('#board').height();
$('#board-wrapper').css('height', board_h2 + 'px');
});
});
});
});
$.address.crawlable(true).path(rewritepath);
return false;
});
Many thanks for your time and help.
What I did is that I removed the root site url from link url and it works.
$('.ajaxed,li.menu-item-object-page a').live('click', function(event) {
var link = $(this).attr('href');
var toRemove = MySettings.url;
var url_pathname = MySettings.url[0].pathname;
var rewritepath = link.replace(toRemove,'');
...
});

Ajax form and google conversions - the tricky part

For 2 weeks now i have tried to impliment the google conversion code to one of my ajax form landing page.
what i had in the ajax after success is
var google_conversion_id = **MYID**;
var google_conversion_language = "iw";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "**MYLABEL**";
var google_conversion_value = 0;
$.getScript( "http://www.googleadservices.com/pagead/conversion.js" );
i just didn't work. in firebug i could have seen the js loads after filling the form but no conversion on the page
now what i have ending up doing is adding iframe - hidden, to the success message after the ajax.
this is working but for me is not the right way i wanted to do it
can anyone confirm my code is ok, or help understanding way it didn't work?
I got it to work using a dirty hack.
document.write = function(text) {
$('#footer').append(text);
};
$.getScript( "http://www.googleadservices.com/pagead/conversion.js" );
This is not ideal but it works for me until they remove the document.write from their script.
The current version of google adwords snippet uses document.write (see line 14 of conversion.js) which does not work after your page is loaded. The way I solved my problem is to use an iframe as what you did.
Here are more discussions.
http://groups.google.com/group/adwords-help-advanced/browse_thread/thread/2ef3ee7dc5863e86?pli=1

how many parallel requests does the latest version of chrome, FF & IE support [duplicate]

In Firefox 3, the answer is 6 per domain: as soon as a 7th XmlHttpRequest (on any tab) to the same domain is fired, it is queued until one of the other 6 finish.
What are the numbers for the other major browsers?
Also, are there ways around these limits without having my users modify their browser settings? For example, are there limits to the number of jsonp requests (which use script tag injection rather than an XmlHttpRequest object)?
Background: My users can make XmlHttpRequests from a web page to the server, asking the server to run ssh commands on remote hosts. If the remote hosts are down, the ssh command takes a few minutes to fail, eventually preventing my users from performing any further commands.
One trick you can use to increase the number of concurrent connections is to host your images from a different sub domain. These will be treated as separate requests, each domain is what will be limited to the concurrent maximum.
IE6, IE7 - have a limit of two. IE8 is 6 if you have a broadband - 2 (if it's a dial up).
The network results at Browserscope will give you both Connections per Hostname and Max Connections for popular browsers. The data is gathered by running tests on users "in the wild," so it will stay up to date.
With IE6 / IE7 one can tweak the number of concurrent requests in the registry. Here's how to set it to four each.
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"MaxConnectionsPerServer"=dword:00000004
"MaxConnectionsPer1_0Server"=dword:00000004
I just checked with www.browserscope.org and with IE9 and Chrome 24 you can have 6 concurrent connections to a single domain, and up to 17 to multiple ones.
According to IE 9 – What’s Changed? on the HttpWatch blog, IE9 still has a 2 connection limit when over VPN.
Using a VPN Still Clobbers IE 9 Performance
We previously reported
about the scaling back of the maximum
number of concurrent connections in IE
8 when your PC uses a VPN connection.
This happened even if the browser
traffic didn’t go over that
connection.
Unfortunately, IE 9 is affected by VPN
connections in the same way:
I have writen a single file AJAX tester. Enjoy it!!!
Just because I have had problems with my hosting provider
<?php /*
Author: Luis Siquot
Purpose: Check ajax performance and errors
License: GPL
site5: Please don't drop json requests (nor delay)!!!!
*/
$r = (int)$_GET['r'];
$w = (int)$_GET['w'];
if($r) {
sleep($w);
echo json_encode($_GET);
die ();
} //else
?><head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var _settimer;
var _timer;
var _waiting;
$(function(){
clearTable();
$('#boton').bind('click', donow);
})
function donow(){
var w;
var estim = 0;
_waiting = $('#total')[0].value * 1;
clearTable();
for(var r=1;r<=_waiting;r++){
w = Math.floor(Math.random()*6)+2;
estim += w;
dodebug({r:r, w:w});
$.ajax({url: '<?php echo $_SERVER['SCRIPT_NAME']; ?>',
data: {r:r, w:w},
dataType: 'json', // 'html',
type: 'GET',
success: function(CBdata, status) {
CBdebug(CBdata);
}
});
}
doStat(estim);
timer(estim+10);
}
function doStat(what){
$('#stat').replaceWith(
'<table border="0" id="stat"><tr><td>Request Time Sum=<th>'+what+
'<td> /2=<th>'+Math.ceil(what/2)+
'<td> /3=<th>'+Math.ceil(what/3)+
'<td> /4=<th>'+Math.ceil(what/4)+
'<td> /6=<th>'+Math.ceil(what/6)+
'<td> /8=<th>'+Math.ceil(what/8)+
'<td> (seconds)</table>'
);
}
function timer(what){
if(what) {_timer = 0; _settimer = what;}
if(_waiting==0) {
$('#showTimer')[0].innerHTML = 'completed in <b>' + _timer + ' seconds</b> (aprox)';
return ;
}
if(_timer<_settimer){
$('#showTimer')[0].innerHTML = _timer;
setTimeout("timer()",1000);
_timer++;
return;
}
$('#showTimer')[0].innerHTML = '<b>don\'t wait any more!!!</b>';
}
function CBdebug(what){
_waiting--;
$('#req'+what.r)[0].innerHTML = 'x';
}
function dodebug(what){
var tt = '<tr><td>' + what.r + '<td>' + what.w + '<td id=req' + what.r + '> '
$('#debug').append(tt);
}
function clearTable(){
$('#debug').replaceWith('<table border="1" id="debug"><tr><td>Request #<td>Wait Time<td>Done</table>');
}
</script>
</head>
<body>
<center>
<input type="button" value="start" id="boton">
<input type="text" value="80" id="total" size="2"> concurrent json requests
<table id="stat"><tr><td> </table>
Elapsed Time: <span id="showTimer"></span>
<table id="debug"></table>
</center>
</body>
Edit:
r means row and w waiting time.
When you initially press start button 80 (or any other number) of concurrent ajax request are launched by javascript, but as is known they are spooled by the browser. Also they are requested to the server in parallel (limited to certain number, this is the fact of this question). Here the requests are solved server side with a random delay (established by w). At start time all the time needed to solve all ajax calls is calculated. When test is finished, you can see if it took half, took third, took a quarter, etc of the total time, deducting which was the parallelism on the calls to the server. This is not strict, nor precise, but is nice to see in real time how ajaxs calls are completed (seeing the incoming cross). And is a very simple self contained script to show ajax basics.
Of course, this assumes, that server side is not introducing any extra limit.
Preferably use in conjunction with firebug net panel (or your browser's equivalent)
Wrote my own test. tested the code on stackoverflow, works fine tells me that chrome/FF can do 6
var change = 0;
var simultanius = 0;
var que = 20; // number of tests
Array(que).join(0).split(0).forEach(function(a,i){
var xhr = new XMLHttpRequest;
xhr.open("GET", "/?"+i); // cacheBust
xhr.onreadystatechange = function() {
if(xhr.readyState == 2){
change++;
simultanius = Math.max(simultanius, change);
}
if(xhr.readyState == 4){
change--;
que--;
if(!que){
console.log(simultanius);
}
}
};
xhr.send();
});
it works for most websites that can trigger readystate change event at different times. (aka: flushing)
I notice on my node.js server that i had to output at least 1025 bytes to trigger the event/flush. otherwise the events would just trigger all three state at once when the request is complete so here is my backend:
var app = require('express')();
app.get("/", function(req,res) {
res.write(Array(1025).join("a"));
setTimeout(function() {
res.end("a");
},500);
});
app.listen(80);
Update
I notice that You can now have up to 2x request if you are using both xhr and fetch api at the same time
var change = 0;
var simultanius = 0;
var que = 30; // number of tests
Array(que).join(0).split(0).forEach(function(a,i){
fetch("/?b"+i).then(r => {
change++;
simultanius = Math.max(simultanius, change);
return r.text()
}).then(r => {
change--;
que--;
if(!que){
console.log(simultanius);
}
});
});
Array(que).join(0).split(0).forEach(function(a,i){
var xhr = new XMLHttpRequest;
xhr.open("GET", "/?a"+i); // cacheBust
xhr.onreadystatechange = function() {
if(xhr.readyState == 2){
change++;
simultanius = Math.max(simultanius, change);
}
if(xhr.readyState == 4){
change--;
que--;
if(!que){
document.body.innerHTML = simultanius;
}
}
};
xhr.send();
});
I believe there is a maximum number of concurrent http requests that browsers will make to the same domain, which is in the order of 4-8 requests depending on the user's settings and browser.
You could set up your requests to go to different domains, which may or may not be feasible. The Yahoo guys did a lot of research in this area, which you can read about (here). Remember that every new domain you add also requires a DNS lookup. The YSlow guys recommend between 2 and 4 domains to achieve a good compromise between parallel requests and DNS lookups, although this is focusing on the page's loading time, not subsequent AJAX requests.
Can I ask why you want to make so many requests? There is good reasons for the browsers limiting the number of requests to the same domain. You will be better off bundling requests if possible.
A Good reason to move to http 2.0
With http2.0 the maximum number of connections per host is virtually unlimited: Is the per-host connection limit raised with HTTP/2?

Resources