IIS bindings and google analytics - iis

I have a question that relates to setting up google analytics on a website. I have one website setup on a Microsoft server using IIS. Let's call it www.example.com
for this website I have added a couple of binds that relate to the different domains like www.example.eu and www.example.gov
With this is mind I only have one website to manage and to control and all the bindings exist just to have the possibility of using all the domains purchase without having any redirects when an user try to reach the website.
It's now time to start the analytics. But I'm getting a bit confused on how I'm going to setup this.
I'm I corerect and thinking that the only thing I need to add to my website is the following code?
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->
Or do I need to think of a cross domain setup like?
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['www.example.eu, 'www.example.gov'] );
<script async src='https://www.google-analytics.com/analytics.js'></script>
<!-- End Google Analytics -->
Again www.example.eu and www.example.gov is not a website but just a bind to one www.example.com.
Hope you can help me to figure it out the best way to setup google analytics.
Thank you in advance.

Google Analytics is a client-side technology, so it does not really "know" about your server settings and simply looks what is in the address bar of the browser.
If your users can browser the different domain names, and you expect them to change between domains during a session then you need the cross-domain setup with the linker.
If your users can access your website via different domains, but you do not expect them to change from on domain to the other during the visit then you do not need the cross-domain setup.
(For completeness sake, if you had redirects your would not need cross domain tracking either as long as the redirect is done via the server, or done client-side before the tracking code is executed).

Related

Filter Google Tag Manager to only my main domain ( exclude testing environments )?

I have multiple environments for my web app to run: localhost, testing and then production.
I want to have the same GTM code but to somehow tell GTM to filter out everything besides real requests on my production server (could be done by domain, example.com).
I know I can do this in JS where I check hostname and don't include the tag code if hostname is not my main domain but I would like a solution that I configure on GTM so that i'm 100% sure that is working and I'm not getting wrong data on it.
What I can't have is a different codebase for each environment.
What's the best way to manage this?
There is a built-in variable in GTM called Page Hostname, so you can set it as a condition for your tag's triggers. For example, you may change a Google Analytics tag's trigger from All Page Views to Some Page Views, where page hostname matches your site's hostname.

what is the ''/home" after the website domain name?

I'm new to web development and i want to ask that why some website have the "/"?
for example https://www.roblox.com/home, notice the "/home" what does that called
I have tried to search on google and i can't find the answer
And some website have like "/login.php", "/index.html" it can also be html?
These are URLs (https://en.wikipedia.org/wiki/URL) and they identify the resource you are trying to reach. I would suggest reading more about how web pages works to get a better general overview of things(e.g.: https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/How_the_Web_works)
How these resources are actually interpreted depends on the server side implementation:
.php are usually processed by PHP web server
Other static files such as images (*.png , *.jpg, etc), html files, svgs, CSS, js, etc - Are usually located in the local server by the web server (httpd, tomcat, IIS, nodejs, and many many others) and the files as transmitted to the client 'as-is'
When using online tools to build websites, these complexities are usually abstracted away, and in the end URLs will just mean a resource identifier.
[domain]/[section]/[page(.html|.php)|resource(.js|.css)]
domain: the address of the website
section: a way to navigate inside the website itself
page: the user interface that might be rendered server side of client side hold the controls shown to user
resource: files that changes how the content in the pages looks and behaves like

Using Masked Custom Domain with no iframe on IBM Bluemix

I have a domain with Namecheap that I would like to point to my IBM Bluemix app. I have tried masked redirection: this just places the Bluemix app in an iframe. The issue with that is that when the user clicks a link in the app, the URL in the bar doesn't change (only the iframe path changes). Additionally, if I use unmasked redirection, then the URL simply changes to the Bluemix URL (appname.mybluemix.net). What can I do? Is it possible to point my domain to Bluemix's name-servers? How can I get my app to behave like it resides at the domain (No iframe, and no URL change). Is this even possible with Bluemix?
Thank you,
--
You can't it with Namecheap (Url cloacking) and URL Frame is bad for SEO.
You can use a custom domain for your Bluemix Application. The documentation is here: https://www.ng.bluemix.net/docs/manageapps/updatingapps.html and here: https://www.ng.bluemix.net/docs/manageapps/securingapps.html

can files on cloudflare disappear and what about performance

So i'm new in the web development world. But for some plugins i use at angular i notice that some use cloudflare.
like this :
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/select2/3.4.5/select2.css">
So my question is should i download the files just in case or will they be permanent online ?
And will this improve the speed of my website if u use cloudflare or is it just the other way around. because i notice that some files are not using a compact css file.
So that isn't actually referencing a site on CloudFlare, it is referencing a service called CDNJS, CloudFlare provide CDN services for them. These URLs are intended to the permanent endpoint in order to access scripts from CDNJS.
In ordinary CloudFlare sites, the CDN is transparent. CloudFlare works by proxying requests from the user to the origin server, they sit in the middle and perform caching and optimisation from their 64 data centers around the world, no need to alter your code at all.

AngularJs Routing without hashtag in link?

I've recently began learning AngularJs for web development and am loving it so far. However, I'm not so sure about having hashtags withing the link when routing between views. My main concern is how Google will cache the pages on the site and whether the links will work both ways, i.e. whether users can just click www.sampledomain.com/#/orders/450 and be directed straight to the order page. Is this an okay method or is there a way to route views without the hashtag?
When I remove the hashtag, the reload the page and gets 404 error. Can anyone give me a decent explanation of what is going on. Thanks
When I remove the hashtag, the reload the page and gets 404 error
That's because in your server side code you are probably not handling a request like "www.sampledomain.com/orders/450"
You can have your server-side code handle this request by either returning a redirect to the new URL ("www.sampledomain.com/#/orders/450") or just return the correct HTML directly. The "right" solution will depend on your needs.
User can just click link with a hashtag and it will be directed straight to the order page.
Google treats links with hashtags as different URL's when the content is different. It's more about SEO then angular.js, but here is an article about that: The First Link Counts Rule and the Hash Sign - Does it Change PR Sculpting?
You might want to set Angular's $locationProvider to use html5Mode.
FTA:
$location service has two configuration modes which control the format of the URL in the browser address bar: Hashbang mode (the default) and the HTML5 mode which is based on using the HTML5 History API. Applications use the same API in both modes and the $location service will work with appropriate URL segments and browser APIs to facilitate the browser URL change and history management.
html5Mode will give you "normal" urls in modern browsers while falling back to hash bangs on older browsers.
An html5Mode url:
http://foo.com/bar?baz=23#baz
a hashbang url:
http://foo.com/#!/bar?baz=23#baz

Resources