I'm trying to solve a problem with tracking traffic to individual blog posts on a system that uses a javascript redirect system where something somehow break tracking.
The way the system works is as follows:
Permalinks are in the format of domain.com/ab_XXXXXX where ab_XXXXXX is a unique code. That code is parsed by a piece of javascript, which tells the browser to load the individual blog post page. This page has a URL format of blog.html/?cd_XXXXXX_ef=YYYYYY. Here too, XXXXXX and YYYYYY are unique codes which, combined, identify the particular page.
When I load the blog.html/?cd_XXXXXX_ef=YYYYYY URL directly, Google Analytics does seem to track the page and the user shows up in the real-time dashboard as visiting that particular page.
However, when I load the domain.com/ab_XXXXXX URL, the user does not show up in Analytics' real time dashboard, even though the analytics tracking gif gets loaded.
Since the ab_XXXXXX URL is the permalink, Analytics appears to contain no data on individual blog post visits at all.
I'm not the programmer on this system, and at this point I'm not sure what to test or to suggest as changes to the programmers.
My question is: why would Analytics track the user in the one occasion, but not in the other? And what could be done to remedy this?
Does the page ab_XXXXXX actually redirect the user to cd_XXXXXX_ef=YYYYYY or does it simply load the contents of that blog post into the same page? In either case, but particularly the latter, you can simply choose to manually track the page view in your existing Javascript snipped by adding something along the lines of _gaq.push(['_trackPageview', 'blog.html/?cd_XXXXXX_ef=YYYYYY']);
Related
I've built a site which has forms with event tracking codes, but now the client wants to create goals for specific landing page -> form submission
And all the forms have the same tracking codes at the moment.
Looking in google analytics goal setup it seems I can only add one part goals e.g. by URL or by event tracking code but not
if {this page and this tracking code}
record {this goal}
Is this possible or do I just need to make tracking codes for each individual form on every page?
No, you can't combine event and page conditions in the goals configuration. You'll need to customize your tracking codes to track this, and this can be quite tricky if your form is on some other page than landing page.
By the way, with the current setup, your client can see exactly the same information in Behavior > Site Content > Landing page report in Google Analytics
I follow a forum where people post many links. I've made a script, using javascript and tampermonkey (chrome extension), that first opens all unread thread in new tabs, than it looks for unread posts that have links and opens those links in new tabs.
This script saves me a lot of time and it is working pretty well. Nevertheless, I would like to improve it.
I want to change the title of the page that has been just opened in order for it to show the name of the thread on which the link that sent to this page was. For example:
On the thread "Fruits" there is a link that opens a new tab to a website "www.apple.com". I would like to change the tittle of this page to "Fruits - The name of the page", so I can know from which thread this link comes.
I use localstorage and sessionstorage to send information from one page to another page when my script is navigating inside the forum domain, but I have no idea what I can use to send information across different domains.
Furthermore, I would like to know if there is a way to tell tampermonkey to run the script according to the link that was opened.
I do know how to change the tittle of the page, the problem is taking the name of the thread that is on the forum domain and using it to change the tittle on the new tab that is on a domain different from the forum domain.
Localstorage doesn't allow access on different domain. You need to store that data in database server. The easiest is to sign up a database service, and it provides API you can use. If you're going to host your own, you must write your own scripts that allow CORS to provide the access to database server.
I am trying to distinguish where people are coming to my website on a specific page. So if they come from my list of set pages, I want to pass a different URL to Google Analytics. If the user directly types up the link, the previous page would not be amongst the et pages I have in my list. Hence those visits I will pass a different URL to GA.
I know how to pass pageviews in GA. My problem is, how do I get to know what page they were on beore. I tried using document.referrer, window.location.hostname, and all that jazz but nothing seems to work.
Need help soon, thanks!
You can do that with PHP only (or any other server-side language) generally. The referrer is sent with the HEAD request to the server, so, in PHP you would use
$_SERVER['HTTP_REFERER']
How can I add google analytics tracking code to a page that redirects.
For example say I have a vanity url www.simpleurl.com that is redirected to www.hardtorememberlongurlofdoom.com/folder/?q=qwerqwe
What would the best method be to track hits to the simpleurl.com. Currently Im using the redirect feature from my hosting company. What I think I should do is turn that off and create and index.html that runs the tracking JS and then redirects the page.
Does anyone know if there is a standard practice for this technique?
If you want to track it with JavaScript and not by using PHP on the simple domain (before the redirect) then you could set the script to track on the long domain and filter by referrer? You can get the referrer using document.referrer.
Another solution could be to set up Google Analytics to track by referrer on all visits and then you've got data to see how many goes through the (or maybe even several) simple domain(s) and how many goes straight to the long domain.
EDIT:
Actually you could just have the tracker on the long domain and all the data should be fine in Google Analytics: Here
The only problem with this approach would be if you want information about the referrer from the simple domain.
The homepage of my website is a form (like Google's homepage) that sends the user to the same page once it's submitted. In other words, when the form is submitted, the page basically refreshes and loads something else.
Using Google Analytics, I can tell that a lot of people are exiting from my homepage. I want to find out if they're exiting before or after submitting the form. Is this possible?
If the users are coming to your homepage directly, you can check the difference between the bounce rate and the exit rate. A bounce occurs when someone views a single page on the site and then leaves. So if they are submitting the form they shouldn't be bouncing but rather exiting.
You can also setup a funneled goal. Basically you'd setup a goal based on destination (your homepage) and then select to have a one step funnel that would also be your homepage. I haven't tested this but if it works like the documentation states then the goal should only be reported when users go from your homepage to your homepage (eventually)...
I'd suggest adding a query-string parameter to the form action so you can easily see when people are viewing your homepage after submitting the form. If your action is like this:
<form action="/index.php" ...
then change it to something like:
<form action="index.php?form=submitted" ...
I think this is the easiest way to track which data is being displayed on a page. Another method would be to use a custom bit of JS that reports the URL of the page to Google, so you can append the query-string parameter transparently to the user or even use a different file name in the URL.
When I take-over a site and AJAX-ify it, I normally use a combination of query-string parameters and custom reporting to Google (in JS) to mimic regular page-views so that analytics make sense for both versions of the site (meaning good time-over-time reports can be had).