Can I Setup a localhost virtual host on google analitcs - google-analytics

I have a virtual host, say, http.mylocalhost.com on my localhost. I want to use google analytics. Can I create project with my this virtual host on google analytics and it starts working of tracking the visits and every thing?

If you have a public facing address associated with a web server that can be reached, then yes, you can put their validation code inside your header or the html file in your directory and it will validate it and you are good to go. But if not, then I don't see how you would get the data sent for aggregation or analysis.

Related

Custom domain for an IBM Cloud static website

The problem I am trying to solve is to configure a custom domain name, such as example.com and www.example.com for an IBM Object Storage Static Website. The part I especially need help with is the domain validation part.
Using the tutorial Accelerate delivery of static files using a CDN I have created an IBM Cloud Object Storage Static Website. My browser says that site (page) is dangerous but I am not sure why; that address is the public endpoint for the index.html document.
I tried to configure static.whateversam.com for the site. Currently the DNS does not have a CNAME or A record. I have created a CDN (Network) resource. The status is Domain validation required. When I view the details of that then view domain validation I get a pop-up with 4 tabs. The first tab is for CNAME and the description says ONLY if your domain is not serving live traffic. I do not know what that means but I seem to be using that. The second tab is for Challenge domain. I have tried to use that but when I try to edit the CDN details I am unable to edit the CNAME and other settings.
The tutorial uses static.yourdomain.com for the domain. I am not sure I can use the same procedure for www.yourdomain.com and for yourdomain.com. I am interested in complete and understandable instructions for configuring a custom domain for an IBM Object Storage Static Website but that might be a separate question.

How to configure URL Redirect in Azure DNS Zone

We have multiple websites under Azure DNS Zone
ourbusiness.net
Given multiple Web Apps like So:
foo.ourbusiness.net
bar.ourbusiness.net
We would like to add URL redirects(Correct term?) such that navigation to the following:
foos.ourbusiness.net
thafoo.ourbusiness.net
morefoo.ourbusiness.net
all redirect to:
foo.ourbusiness.net
Would need the same for other apps like bar, baz etc, not just foo.ourbusiness.net.
We do not want an alias, the browser navigation needs to navigate to foo.ourbusiness.net in the browser URL.
I think it is possible using a combination of multiple A Records and a Ptr record. This would require a static IP or Virtual IP address(however that works.)
We use SSL.
What is the most direct way to accomplish above requirement in Azure? Thx..
According to your request, I think the most direct way is to set multiple A records.
It does need a IP address for the Web App and this solution need some cost. However,
NOTE: The IP address may change if you delete and recreate your web app, or change the web app mode back to free.
You can find more details about how to get an IP for Web app and in this document: Map an existing custom DNS name to Azure Web Apps
So,if you worry about this, I recommend you to configure CNAMEs .
Based on this requirement "We do not want an alias, the browser navigation needs to navigate to foo.ourbusiness.net in the browser URL." you need a HTTP redirect to tell the browser to navigate to a different address, i.e. foo.ourbusiness.net. That's not provided by Azure DNS but you could look at something like Azure Functions to create a HTTP reply with the correct HTTP return code etc.

OAuth + Google + Wordpress plugin

Background
I want to create a PHP application that eventually will be installed on a "countless" web servers.
The application is going to access the Google Drive associated with the web server's administrator Google account (it will basically write some files on user's cloud storage). So my PHP app will be authorized by the end-user to use its Google Drive storage. This is done (via the OAuth2 protocol) by connecting the Google OAuth2 service.
So basically I have to create a ClientID/Secret pair (on behalf of my Google Account) that is gonna be used to execute the authorization flow.
Google provides 3 authorization methods:
for web applications (web browsers over network)
for service account (my server to Google server)
for installed application (like Android, IPhone)
(1) is perhaps the best choice EXCEPT that I have to define a REDIRECT_URI where the authorization code will be sent. Because my APP will be installed on a "countless" different servers I don't know in advance the protocol, domain name and the path (also the URI) where the Google's response should be returned. If I would install this application only on 3 servers I could create upfront a ClientID/Secret pair for each of them. It's not the case.
(2) means to deploy my P12 private key with the PHP application and I don't feel comfortable with that!
(3) means to put the end-user to copy/paste an authorization token from a Google web page into my application web interface. I am trying to avoid doing that.
I already made it to work by using the method 1 when I know in advance the REDIRECT_URI. I also embedded the client_id/secret pair in the source code so the whole authorization process is user-friendly. But this is not going to work on a "countless" deployment scenario.
Questions
Which method and how should I use it in order to make the whole process safe for me (as developer) and for the client too (the web server administrator). Note that the authorization process should not involve the end-user to copy paste some codes. I want that step to be transparent/user-friendly for the end-user (no one likes copy-paste when it can be done automatically).
Should I embed my client_id/secret into the application or that's totally wrong? I suppose no end-user wants to go through the creation of its own ClientID in Google Developer Console, right? On the other hand why I would give my client_id/secret to an unknown end-user?
Final thoughts
I could create a proxy application on my (the developer) web server such that my PHP application (which is supposed to be deployed "everywhere") will send the authorization request to my proxy server (which has already its own client_id/secret) which in turn will redirect the call to the Google OAuth service which then REDIRECT_URI back the authorization code to my proxy and finally I will redirect back the response to the original sender (the PHP application). What do you think?
Some useful answers here and here or here.
#Edit: as I've already said earlier a proxy would be a solution. I've made it and it works. The same solutions I've received also from user pinoyyid. Thanks for your answer too.
A proxy is the only real option open to you. You can encode the originator URL in the "state" parameter, so that when the proxy receives the access token, it can call a webhook at the originator.
There are some contradictions in your question...
"The application is going to access the Google Drive associated with the web server's administrator Google account" and "So my PHP app will be authorized by the end-user to use its Google Drive storage." are mutually exclusive.
If the Drive storage belongs to the app, then the user isn't involved in any OAuth dialogue.
Could you edit your question to be clear who is the owner of the Drive storage as it greatly influences the OAuth flows.

Urchin counting google access to an intranet?

We have Urchin installed for the server statitics. Our server has an intranet subdomain (of course, banned to the outer access). When I look for the referal of any intranet page, I found that almost half of the access are from "direct[(none)]" and "google[organic]":
"direct[(none)]" access includes bots, direct keyboard access,
pdf/documents links... and all of these have the acces banned, and
"google[organic]" access are done through the serach engine
that can't acces to index the page nor redirect to that
So, I must conclude that the statistics of Urchin are not faithful.
Can anybody confirm that terrible conclusion? Or can anybody explain and correct it?
There are several ways to install Urchin. In this response I assume you use the tag method.
Urchin will create traffic sources based on document.referrer, it doesn't guess, it uses real data.
When you install Urchin one of the options you need to set is the domain name. This setting is used to store a first party cookie that will hold session information including referral info.
Let's say your intranet site is intranet.mycompany.com, this subdomain is private to your network but maybe the cookie setting in Urchin is set to mycompany.com, this will create a cookie in that domain and this cookie will apply to all subdomains.
Maybe this hostname has other subdomains, some that might be accessible outside your corporation and since they share the same cookie, they will share the same traffic source as well.
google/(organic)
Imagine this scenario:
User Looks for Company in Google
User arrives at the main public site at www.mycompany.com. Urchin registers this as a new visit from google/(organic).
User opens the intranet website
Urchin uses the same cookie and this is seen as a continuation of the visit that already has a traffic source
Urchin just reuses the google/(organic) traffic source defined in the cookie.
Also Urchin can share cookies with Google Analytics, so if you are not using Urchin, but instead Google Analytics the scenario above is also possible.
direct(none)
Now about direct/(none). This is used everytime urchin can't determine a better traffic source. In other words when the javascript variable document.referrer is empty.
This can happen in a variety of moments, including but not limited to:
Clicks on a pdf document
Clicks in a Microsoft Office document
Directly typing the url in the browser navigation bar
Clicking in a bookmark
Going from an HTTPS to an HTTP webpage

How do I allow a user to use their own domain name for a hosted service?

I am working on an ASP.NET MVC web app that allows people to publish content, but other than publish the content to a remote server, I want to allow people to use their domain name directly. For example, the user "Tom" can have his domain name TomSite.com point to http://www.mywebapp.com/user/tom, but the sub path will also be mapped. For example, TomSite.com/path will be mapped to www.mywebapp.com/user/tom/path, and this is transparent to the web visitor. The visitor will never see "mywebapp.com" anywhere on TomSite.com.
I think Smugmug.com provides such service, to allow people to use their own domain name for the photo portfolio. I want to achieve the same result.
How can I do this? Thanks!
This require multiple steps.
First you have to find out how your users will configure their domain to have a CNAME record for you site. You can archieve this in a number of ways where the best is education. Making partnerships with hosting providers requires a great deal of volume.
In IIS this will require you to either add each host name manually (however this could also be archieved through scripting) or have a dedicated IP address only for you site.
There is also a need for the domain to be associated with an account. The user has to add this themselves and you would probably add a check in the interface which confirms the domain is pointed at your server. The code for this would look like (remember to include the System.Net namespace).
if (Dns.GetHostEntry("www.user.example.com").HostName == "www.example.com")
{
// www.user.example.com is a CNAME for www.example.com
}
In you ASP.NET MVC project you need to implement routes for this particular purpose. Create a custom class inheriting from Route which also takes the domain into account.
Smugmug (who you mentioned) get their users to setup a CNAME record that will alias the url for the user's personal photo section. For most users this will probably require them contacting their host or looking up help files in order to get it all setup.
So, while www.tomsite.com could transparently serve up pages hosted at www.mywebapp.com the users will have to put some kind of effort in. To make it a completely seamless you will need some kind of arrangement with the users web host (Smugmug appear to have such an arrangement with GoDaddy).
I doubt you will be able to setup such integration with all the web hosts out there, so the only complete solution would be to host the websites of your users yourself (I do not know enough about your wider situation to determine if that is a reasonable solution).
Note: setting up an alias on your own web server (aka url rewriting) will not work, unless you host their site yourself, as obviously people fetching from your user's domain will not arrive at your server in the first place.
Have each customer's friendlyname pointed at the external ip address of your webserver.
Use IIS to resolve the friendlyname specified in the host header request to the logical website you want delivered to that friendlyname. IIS will happily map both a website and a virtual folder to the same folder in the file system. Create a website for each customer. Then bind that website to the customer's friendlyname.
Remember to map the default website only to your own friendlyname(s). If you leave it in promiscuous mode (mapped to "*") results will be unpredictable.
To set host header mapping
Select Default Web Site under the Sites node. In the Actions pane at top right click on Bindings... to open the Site Bindings dialog. There will be a list of bindings, probably containing a single entry that says http * 80. Select this and click the Edit... button. Set Host name to your own friendlyname.
Run IIS7 Manager and for each customer site create a website under the Sites node. Set both file path and host header binding while you are creating each web site. Obviously the host header binding (host name) should be that customer's friendlyname.
Just make a new record in your webserver setting tomsite.com directly to your mywebapp.com/user/tom/ path ?
See it like an alias :)
Ofcourse, since you're asp.net/windows based, i think you'll have to digg deep into IIS to automate this kind of stuff. If you were on apache it would be adding 3 simple lines to httpd.conf.

Resources