I am currently working on a web app that will be running in an iframe on the webpages of our customers. Now i would like to setup google analytics tracking in a way that i that i can easily distinguish one customer from the other. My plan is to "fake" subdomains, even though it is always the same TLD, so that i can setup a profile for each customer, but still have overall analytics as well.
For example my URL is http://www.domain.com/#/3 where 3 is the customer id. Now i would like to see that in google analytics as 3.domain.com.
Is that possible by doing something like this:
ga('create', 'UA-XXXXXX-1', 'domain.com');
ga('set', 'location', 'http://id.domain.com');
or do i have to go about this in another way? My google analytics knowledge is limited to reading the stats and tracking events and pageviews, so maybe there is a whole different and better way to do this - i am open for suggestions.
Thanks!
It will be much better to use custom variables for this purpose. They give you additional segmentation possibilities on any values and metrics you need, such as customer names or IDs (or both ...)
Related
I have a Content Management System which let people create websites. the CMS has multiple theme and color schemes which they can choose. Every website created using this CMS has a unique domain (www.abc.com, ww.xyz.com etc).
Product In detail:
I have a website mywebsite.com people can signup there, buy their own domain and create their own website at mywebsite.com. so now they have their own xyz.com website where user can add content from mywebsite.com
All these websites are independent, they just share the same code as they all are using my CMS but they have their own content (pictures, videos, text)
I would like to track the statistics of all these websites all together. It is not a problem if a user goes to abc.com and then goes to xyz.com is counted as different session because they are totally different websites and I want google to count them separately.
I want to do this to check how much views my product is getting as whole. which is the best way to achieve this.
Thank you for your time.
What you're after here is what is referred to as a "roll up" account, this is as standard a feature available in Google Analytics Premium (or 360 as it's now known).
However assuming you don't have the financial resources to drop £100k on a Google Analytics premium account you can achieve similar through double tagging on the same website.
This is fairly straight forward and you can see Google's documentation on this on the link below:
https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers#specifying_fields_at_creation_time
As an example:
ga('create', 'UA-XXXXX-Y', 'auto');
ga('create', 'UA-XXXXX-Z', 'auto', 'rollupTracker');
ga('send', 'pageview');
ga('rollupTracker.send', 'pageview');
Where UA-XXXXX-Z is your property ID for the roll-up account and UA-XXXXX-Y is your users' default tracking code.
Note there are a few caveats to using roll-up views:
Even with cross domain tracking you could end up with more than one session across domains for the same user (if they landed on site A then separately landed on Site B before clicking back to site A)
You could hit the rate limits and sampling limits imposed by Google pretty quicky.
You'll need to use either View filters and/or advanced segments to see the statistics of separate websites and this will only exasperate the issue of sampling limitations.
Detail of the premium Analytics implementation is available over at Luna Metrics:
http://www.lunametrics.com/blog/2015/02/03/rollup-data-google-analytics/
This is a huge ask.
Google Analytics relies heavily on cookies, which are unique to the domain. This means that if Person A is on Site 1, and moves to site 2, your Google Analytics has no way of knowing that that was the same person; they will effectively become a new person every time the domain changes.
Now that's not a problem if you're going to have no links between the sites (although you may want to look into prepending hostnames http://www.lunametrics.com/blog/2015/12/10/basic-google-analytics-filters/#Prepend Hostname to Request URI)
But if you're going to link the sites together then it gets a bit more complicated. You're going to have to set up cross-domain tracking (http://www.lunametrics.com/blog/2015/06/16/cross-domain-tracking-with-google-tag-manager/) on each of these, which is best done using Google Tag Manager. Now depending on your implementation this could be a real headache for you, as this requires the GTM container for each site to have a list that names all of the other sites. This list would need to be updated on every container each time you add a site. However, you can make this significantly simpler if you just go for a straight-up Page View tag, and use the same container on each page.
General setting
I have a website, which uses regular and encrypted urls. Now I want to track the pageviews or all pages the same way.
I have regular URLs like this:
/library.dll?page=page12&arg1=0&arg2=some&session_id=7892734
and special pages like this:
/library.dll?page=specialpage&arg1=0&arg2=some&session_id=7892734&id=page13
aswell as encrypted URLs like this, which are also containing the session id:
/library.dll?page=encrypted&args=gYZEI7lnRAQLzVXdtdbcral8.cOoc6NDtMUGY2yep9wO3JM
So the interesting niformation is always the page, which is in this examples page12, page13 and page14 (where page14 is also part of the encrypted string).
Clarification
I can change the HTML and JS code only. I have no access to the Google Analytics interfaces at all. This will be administrated by multiple customers.
The GA code will be integrated within a template using a customer-specific code and their unique tracking id.
Problem description
I need to track the page argument, because this is basically the interesting part of the url. When tracking other url parameters I cannot accumulate the pageviews for a certain page, because Google Analytics shows them as separate pages.
In addition I don't see any way to track the pageviews with encrypted URLs, because I cannot set a generic name for them unless there is a way to utilize the method ga('send', 'pageview');
Solution idea
I read about overwriting the pageview attributes like this:
ga('send', 'pageview', '/my-overridden-page?id=1');
in the article on page tracking #Google Developers
Utilizing (event) triggers is in my opinion a pretty bad idea.
The question itself
Is there any smarter way to track this information? Is extracting the page-information and overwriting the pageview attributes the best way to do this?
I just started using GA and have kind of no idea how to do this any other way.
You could use filters (custom advanced filters) to rewrite the request url inside the google admin interface (admin->views->filters). This has the advantage that you do not need to change your site/application code.
However using filters will require multi-step-filters with heavy use of regular expressions, and you would have to test this in a "staging" view first (because a wrong filter will permanently mess up your data).
Passing a custom url to the pageview tracking is pretty straightforward and can be tested immediately via the real time view. In my opinion this is indeed the smartest way to do this.
I am curious if Google Analytics Content Experiments supports targeting based on the traffic source, in particular, certain Google Adwords campaigns.
For example, I have two Adwords campaigns pointed to the same destination url but would like a Content Experiment to only run for one of these two campaigns.
Even targeting the experiment based on the referring url would be helpful but I don't see an option to do so when setting up the experiment. Does anyone know if this is possible through the set up, or if I would need to create some kind of gateway that my campaigns funnel through and then get routed to the experiment URL based on the source?
Thanks!
Google does not currently provide this function by default.
I'd try https://www.optimizely.com/ (easier) and/or patching up custom bucketing code (more difficult)
Site A gives their affiliates an interactive component (traffic map based on Google Maps), which they in turn put on their sites (Site B) in an iframe. The component is dynamic, doesn't change the URL of parent site, and has an id for each affiliate site.
What I would like to do is track the displays of the component. (Price of using Google Maps for the component depends on number of views).
At the moment the component is in <iframe src="http://SiteA.com/q?cp=43.520,18.910,10&cm=1"></iframe>.
I have looked at the other topics but didn't found a solution to that problem. I would really appreciate any help, I had no experience with cross-site tracking yet.
You as siteA owner want to count number of displays of iframe on other sites, correct?
The basic way to do it is logs analysis — every time your server returns page http://SiteA.com/q?cp=43.520,18.910,10&cm=1 or similar it adds an entry to your server's log files. The can be count when. There is a number of solutions for analyzing log data. Some of them opensource and free, other are paid services. For exmaple: http://awstats.sourceforge.net/
There is other ways to count it, but it's probably easiest way of all.
I have been requested to get involved with a family member's site.
To date, they have been paying an SEO outfit, which I believe has been feeding them lies and milking them for money.
I can see that all pages in the site have Google Analytics. However, the SEO outfit refuses to let us see the Analytics page, and has always just forwarded them some (presumably doctored) slideshows.
The only tracking service that lists their site is Compete, which shows a number of visitors far from what they are paying for.
I would like to add their site to my own Analytics account. I have ftp access to their server, and permission from the site owners to modify any files I want.
However, I don't want to do anything that might destroy the entire existing history of analytics data, or even that would interfere with the current SEO outfit [until I have something concrete in-hand].
Does anyone know:
Can I add Analytics to my own account when it was originally setup by someone else?
Will there be any negative results of attempting this?
Any other ideas?
Thanks
Edit: Can anyone suggest a better title - I can tell mine is not good?
I've put two Google Analytics tracking codes from different accounts on the same site without issues. It may cause the site to be a tiny bit slower (as it communicates twice with Google) but it'll do nothing that would delete old data or impede collection of new data.
In short, what you're doing sounds like a good first step.
You will not, however, be able to access past data by doing this. You will be able to compare their numbers with the numbers you're getting, though, which should be valuable.
I don't know if you can add the same domain to two different Google Analytics accounts (easy enough to try, though), but you can always add another service's Javascript snippet, e.g. Woopra. Google and Woopra produced very similiar results in my experiments.
You may want to leave their Google Analytics tracking in place while adding your own Google Analytics tracking. In that case, your numbers should be identical to whatever is being tracked by this third party.
You'll need to set up your own account and then add in the creation of your pagetracker object and your own track page view. You don't need to recreate the entire page code. You can do it with two more lines. It would look something like:
var pageTracker =
_gat.getTracker("UA-XXXXXXXX-1"); //EXISTING pageTracker._trackPageView();
var secondTracker =
_gat.getTracker("UA-XXXXXXXX-1"); //YOUR TRACKING ACCOUNT secondTracker._trackPageView();