Piwik and HostGator

I tried to follow the instructions to set up Piwik with HostGator found here: Anyone successfully installed wp piwik?

Following the instrucitons in the post from “east_coast_alex”, I set it all up the way he detailed, with no problems except a “404 mod_security” warning at the beginning which “east_coast_alex” has a work around for (via the Piwik troubleshooting).

I set up everything and for some reason, it isn’t tracking visits. I base this on the fact that I’ve been clicking around my website and Piwik hasn’t recorded any visits. Any ideas?

Please ask hostgator to whitelist your account from the mod_security list

I did this and they wanted me to go through a lengthy process to do it. Considering that I am going to be using Piwik for many of my clients (hopefully) and I don’t have access to all of their hosting information, I would like help on a work around instead of going through HostGator.

I tested two domains. One it works just fine for and the other, it won’t work at all. The only difference I can see is that the domain it does work for is the main domain on my shared hosting program and the other domain that isn’t working is just a subdomain technically.

Would this make a big enough difference to mess up Piwik?

Let me clarify my issue a bit.

I have two websites: website 1 and website 2. Website 1 is working just fine. Metrics all working, etc. Website 2 is not working at all. No metrics, period.

Neither website is whitelisted by HostGator. Both websites were set up the exact same way, with the exact same code (I rechecked it again just to make sure) except, of course, with differences in the website addresses where applicable. The only difference between these two websites is website 1 is my main domain for my “Baby Plan” at HostGator and website 2 is an “add on” domain. Would this break everything down?

Could you list the actual domain names?

You say you have 2 websites where one is a add on domain, are you reporting into one website in piwik or have you defined 2 separate ones?

When you say add on domain do you mean its a domain that is customer set up in essence(you are acting as a host ISP for that domain VS your main domain)

I use hostgator as well and once getting by the mod security issue it works well for me.

I would rather not list the domain names as one is a customer’s and non disclosure is a part of my policy.

Thanks for your help on this issue though and I will try to be as transparent as possible with the rest of the information.

I have two different piwik installations for the two websites. One is not feeding off of the other. I did this because if someone (maybe even Google) were to take a look at the source file or spider it, they could make connections between websites that don’t need to be connected. For instance, two different clients who have no common link except that I handle their website needs.

I am confused on the second question but it is an add on domain as in the first website is the website I signed up with for HostGator. When I acquired the second website, I went in under CPanel and clicked “add on” domain and added it.

I don’t understand why the workaround works for the main domain but not the add on domain.

I’ve tried twice with HostGator to get them to whitelist the mod_security but they tell me there’s nothing mod_security is blocking for them to whitelist. How did you get them to whitelist you?

I didnt need to be whitelisted.

The index.php may have to be slightly different for the add on domain as typically its one level down from your main domain hence why it may be broken.

is the piwik install for each on the same level or is the add on one folder level down? think absolute path name on the server…

I am not a total webmaster, even on a good day haha so I will try to reply the best I can.

The piwik install is on the same level for both domain names. I just went to the file manager and clicked on the individual site. It took me to the files for that particular website and I just uploaded the piwik and installed.

Do you think I may need to list the add on website as ftp.mainwebsite.com in Piwik, if that makes sense? I know HostGator actually makes the addon a subdomain of the main domain. Do I need to reflect that in the script? So instead of www.addonwebsite.com it needs to be .mainwebsite.com?

I hope that makes sense…

I think the right answer to your question is both installs are on separate levels. Each Piwik install is on the same level as the index.php of the respective website.

ok you mention the domain so that it looks like its a sub domain and not a add on domain.

to clarify

ftp.mydomaiin.com is a sub domain of mydomain.com

An add on domain would be a different domain name like mydomain2.com

The problem may then be piwik may have a problem as the location of teh sub domains folder is different than the main domains folder so definitely check the paths structure in the php files.

Normally a subdomain i would think if the js script is the same would end up being put into the data of the main piwik install. I think since this is a sub domain the whitelisting is the way they allow a sub domain to be separated and report like a seperate true domain.

If you are looking at providing a service of tracking various sites would it not be an option to have your one domain to host piwik. Create separate JS code for each site that would be placed on all the various sites and mange it from one piwik install?

Since the code is custom per site the domains would have not real relation that google would group to.

Even if you begin to host various web sites via cpanel since they are separate domains that scenario would work.

just putting options out there as since you specify a subdomain as part of your URL then it will be grouped in a sense by google to your main domain.

I appreciate all of your help, I really do.

As I understand it in HostGator, an add on domain is actually just a subdomain of your main domain name. Whatever the reality is, it is definitely an add on domain that I am working with.

The reason I don’t manage all of Piwik from my main domain is because if you do this, any tracking code you generate will have the main domain as a part of the tracking code. Another issue I hadn’t though of is my clients will want to login to their Piwik to see their stats as well. It’s much more branded if it’s already on their specific domain, if that makes sense.

For my particular site, since it isn’t the main domain, am I going to need to specify the true server path as the domain name instead?

Well, it worked.

I am going to write this for any future people with the same problem.

HostGator allows you to add on multiple domains (these are called “add on domains”) so that you can have as many domains as you want on one account. This is a pretty great feature but there is one issue to be aware of: when you add on a domain, it technically becomes a subdomain of the main domain that you first signed up for your hosting account.

Let’s say when you first signed up for HostGator you singed up your main domain: “www.maindomain.com”. Then, you decided to host a few other sites through your hosting program by using the “add on domain” feature. So, you added a new site caled “www.newdomain.com”. www.newdomain.com is technically a SUBDOMAIN of www.maindomain.com. Considering this, Piwik won’t take www.newdomain.com in the tracking code. Piwik wants the actual subdomain path you set up for your add on domain. It is easy to find this. If you click on “File Manager” in your CPanel, you will see many domain names and subdomains for you to choose from. One of those subdomains is the one you want, you just have to remember which one it is. You set up this subdomain when you went through the add on domain process. Once you remember the correct subdomain, you need to use the full subdomain in the Piwik tracking code instead of the main domain.

Once I did this, it worked. I hope this helps.

Also, I still need help.

Is there any way to circumnavigate having to use the subdomain? It still points to the primary domain in the source code and connects websites that shouldn’t be connected. This may sound strange but I peruse the source code of competing websites all the time. I don’t want anyone looking through one of my sites to see it connected to another site because it’s an add on domain.

Is there another way to enable Piwik to use the “true” domain name for an add on domain?

Since you are hosting a domain as long as your piwik JS code is different for the new domains you should be fine. when you host multiple domains via a source like hostgator you will be using virtual hosts. The only thing that really would tie your multiple sites is the common DNS settings if someone were to pull that. (typically IP address and the name servers)

But domain1.com

and domain2.com

would otherwise appear differently for all intensive purposes

Unfortunately, Piwik won’t allow me to use my full add on domain in the code. It won’t work.

For example, let’s say my add on domain is www.addondomain.com. I can’t use www.addondomain.com. I’ve tried and the data just sits at zero and nothing happens. However, if I use the subdomain that my add on domain is registered under HostGator with, it works. This does tie me to another website because the subdomain is an extension of the primary domain. So, the website I have to enter into the code is addondomain.primarydomain.com.

This can be seen in the source code and ties me to my primary website.

Anyone have an idea on a workaround? This may keep me from using Piwik.

Can you please summarize the issue clearly? thx

Yes.

I have a shared hosting plan with HostGator. The shared hosting plan allows me to have a “primary domain” and then I can have as many other domains on the shared hosting I want via the “add on domain” function. How this basically works is they configure my “add on domain” as a subdomain to the “primary domain”.

Example:

How this appears to the average user:

Primary domain url: www.primarydomain.com
Add on domain url: www.addondomain1.com

How this works technically with HostGator:

Primary domain url: www.primarydomain.com
Add on domain url: www.addondomain1.primarydomain.com

Although you can access the “add on domain” just by going to “www.addondomain1.com” it is actually set up as a subdomain and it’s REAL pathway is “www.addondomain1.primarydomain.com”.

Unfortunately, Piwik won’t accept “www.addondomain1.com” in the script. It won’t work. You have to use the REAL pathway: “www.addondomain1.primarydomain.com”. This is unfortunate for someone in my case because I have a client set up as the primary domain and another, separate client set up as the add on domain. For Piwik to work on the add on domain, I have to use the “www.addondomain1.primarydomain.com” in the script. This associates two websites that I don’t want to be associated at all. I do a page source look up all the time on sites and I don’t want others doing that and associating two websites together that aren’t associated at all except that they’re both my clients.

How can I set up Piwik so that it recognizes the add on domain without having to associate it with the primary domain in the script?

It’s not a problem for Piwik, it’s that you need that the URL you put in the JS works and loads the piwik.js file. If it doesnt then it’s a server configuration problem. If the website addon.com works in the browser then Piwik should work if you set in the javascript addon.com/piwik/ or whatever your piwik URL is ?

You would think just “www.addondomain1.com” would work but it does not.

It will only take take the “www.addondomain1.primarydomain.com”. I have tested and can confirm this. Does anyone know a way around this? By either changing some HostGator functionality or Piwik functionality?