managing redirection with google analytics - google-analytics

I have a site that contains the file
redirect.php?id=123
It redirects folks to another site using an id it pulls from the database.
I'd like to track the page on Google Analytics, see where users are coming from, and what popular sites they're going to.. etc.
I currently set up the page so that it pulls (with PHP) the link from the database, and outputs the ga.js stuff and a javascript redirect.
The issue is that I'm getting the data on my analytics dashboard as if every id is a different page..
What is a better way to do this?

If you want to check for pages of the type redirect.php?id=x then the page Carlos links to is how you would do it.
You would want to exclude the id parameter from your search. Then Analytics would combine all the redirect.php?id=1 redirect.php?id=2 redirect.php?id=3 pages as just a single page named redirect.php
How do I exclude query parameters from my reports?

Related

Google Analytics - Some weird URLs are being registered in behavior reports

We made a google analytics account for one of our clients as part of the requirements.
Under Reporting tab, we have sections like Behavior -> Site Content -> All pages. In All Pages section we are able to see a table which contains all the urls which are viewed with respective pageviews , unique pageviews and other dimensions.
A normal page view looks like:"/pwsportal/faces/homePageNav/mktplan_adf.Ctrl_9_afrLoop_1234423".
Some how there are some weird page urls like :
I tried using Exclude Filters and couldn't eliminate these kind of urls.
From one on the blog i got to know that if any url contains any script tags it is a part of hacking technique called cross site scripting.
Finally i am here to find a solution to eliminate the these kind of existing urls and to prevent them from getting registered in future into google analytics.

Google Analytics Real-time overview shows a page that doesn't exist

I don't understand this. How can this happen?
I have an educational site and when I looked at Google Analytics I saw a porn page in active page which doesn't exist on my site.
What is this and how can I stop this from happening?
I checked for that page on my website and there is no such page.
This is not actually a hit for a Page on your website, it is rather a Referral (i.e. the source from which a user was supposedly coming from before landing on your site): https://support.google.com/analytics/answer/2795830?hl=en
It is actually spam generated by bots and crawlers, and you can follow the steps listed in this article to mitigate this issue: http://moz.com/blog/how-to-stop-spam-bots-from-ruining-your-analytics-referral-data
For the most common sources of Referral Spam, you might want to add an Exclude Filter to simply ignore those hits:
To filter out a referring source from your reports, create the following filter:
Filter Type: Custom Filter > Exclude
Filter Field: Campaign Source
Filter Pattern: Enter the domain of the referring source that you would like to exclude, for example, google.com. You can use regular expressions if you would like to exclude several referring sources.
If you are wondering about the "Active Page" view listing a spammy-looking URL, it is because that page most likely is a 404 page your website serves in response to the request.
Note that the URL also begins with a slash delimiter ("/"), as in yourwebsite.com/www.spammy-site.com -- this will show up in Analytics as /www.spammy-site.com, as in the examples above.
This is Ghost Referrer Spam, and it shows as both pages and/or referrals(you can see it in the screenshot bellow). This "visits" never reach your website actually. The only thing you should worry about is your data since it affects your statistics by adding useless data to your Google Analytics.
The only way to stop them for now is by filtering them in Google Analytics as #Philippe mention you can add a single filter or you can use a more general approach with a filter based on Valid Hostnames that will stop this and most of the Referrer Spam.
Basically, this works by excluding all hits that don't have any of your valid hostnames since the spammers don't know who are they targeting they use a fake or empty hostname as you can see in the screenshots
Here is more information about this solution and others https://stackoverflow.com/a/28354319/3197362
1 In Google Analytics, go to the Admin tab.
2 Go to View Column and select Filters.
3 Click on New Filter.
4 Put Spam Porn Referrals as a name for the Filter.
5 Filter Type select Custom. Filter Field, find and select Campaign
Source. In the Filter Pattern text box, copy and paste this Regular
Expression.
depositfiles-porn.ga|youporn-forum.ga|pornhub-forum.ga|generalporn.org|rapidgator-porn.ga|meendo-free-traffic.ga|amanda-porn.ga|torture.ml|pornhub-forum.uni.me
6 Click Save.
You can check this link also. I have seen the same problem and now i am done with this.
Stop Spam or adult site referrals in google analytics

Google Analytics: Tracking multiple URLs as single page

I run a website where the user is able to create a bespoke page from a template, which is published with a custom URL. For example:
http://example.com/customer-bespoke-url-1
http://example.com/customer-bespoke-url-2
http://example.com/customer-bespoke-url-3
Each of these URLs serve a templated page with custom content, depending upon the URL, but the overall design and layout is the same.
I would like to have the option to track traffic on these pages as a single entity within Google Analytics i.e. combine all the data for these pages together when I need to view the overall effectiveness of the page.
Is there a way I can mark these pages to achieve this?

Google Analytics referral triggered by a bookmarklet

I have a question regarding Google Analytics and unwanted referral stats generated by a bookmarklet.
I have a web service with GA installed. My users are using a bookmarklet to accomplish a certain task while visiting some other web page. Bookmarklet creates an iframe and opens up a page which is also on my domain and that page contains the same GA code.
For some reason GA sees those web sites (pages that bookmarklet was used on) as referral pages. That creates a problem for me since those pages are not real referrals (no actual links to my site). I have no desire to track pages my users marked with the bookmarklet.
It’s important to mention that bookmarklet page must be a part of the same domain as my main page. I can not move it on other domain or subdomain.
This is what I tried so far:
I’ve created a new GA account (subdomain.mydomain.com) and used it only on my bookmarklet page hoping that all stats related with the bookmarklet will appear on that account. This worked only partially. Stats for the bookmarklet started to appear on the new account but my original GA account continued to track referral pages.
We tried to use a pop up window to load a web page instead of the iframe. No difference.
Any help on how to get rid of unwanted referral sites would be appreciated.
See _setReferrerOveride:
_setReferrerOverride()
_setReferrerOverride(newReferrerUrl)
Sets the referrer URL used to determine campaign tracking values. Use this method to allow gadgets within an iFrame to track referrals correctly. By default, campaign tracking uses the document.referrer property to determine the referrer URL, which is passed in the utmr parameter of the GIF request. However, you can over-ride this parameter with your own value. For example, if you set the new referrer to http://www.google.com/search?hl=en&q=hats, the campaign cookie stores a new campaign with source=google, medium=organic, and keyword=hats.
_gaq.push(['_setReferrerOverride', 'URL-YOU-WANT-AS-REFERRER']);
Or, you could try
_addIgnoredRef():
_addIgnoredRef()
_addIgnoredRef(newIgnoredReferrer)
Excludes a source as a referring site. Use this option when you want to set certain referring links as direct traffic, rather than as referring sites. For example, your company might own another domain that you want to track as direct traffic so that it does not show up on the "Referring Sites" reports. Requests from excluded referrals are still counted in your overall page view count.
Async Snippet (recommended)
_gaq.push(['_addIgnoredRef', 'www.sister-site.com']);
You would have to grab the referrer and populate it dynamically. Probably with parent.document.referrer Of course this might make any referrals (non-bookmarklet) from these sites not record in the future. And, at some point you would need to clear them.
The most simple solution, if you don't need to track the hits from the bookmarklet at all, is to simply not include the GA code in the web page when it is opened by the bookmarklet.
Your bookmarklet can open the page like http://yoursite.com/?mode=bookmarklet
And in your server side code you can use something like
if ( mode != "bookmarklet" ) {
outputGaCode()
}

Multiple links pointing to the same location. Track which one was clicked using Google Analytics

I'm trying to get Google Analytics to track the specific link in the page that was used by the users to get to a specific location.
Say I have links poing to the contact page from the main menu, the page's contents and the footer.
Looking at what other websites are doing, I've added references inside GET parameters for each of the links like so: http://www.example.com/contact?ref=menu , http://www.example.com/contact?ref=content and http://www.example.com/contact?ref=footer . I've also added the ref parameter to the ignore list inside Google Analytics so the three URLs are not tracked as separate pages.
My question now is: How sould I go about tracking which one was used to get to the contact page?
Although the post is a bit old, for others like me finding this via search, here is the solution. Enhanced Link Attribution in Google Analytics.
http://support.google.com/analytics/bin/answer.py?hl=en&answer=2558867
Sounds like you are already tracking them with the URL param.
If Google Analytics is successfully tracking them as separate pageviews with the ref= URL param, then you could create a custom report in GA that shows the number of pageviews. The custom report can be added to your dashboard for quick reference.
The custom report can be set up like this:
Metric groups: pageviews
Dimension drilldowns: page
Filters: include -> Page -> regex -> /contact\?ref=(content|menu|footer)
Or, for each click, add the following to each link:
Contact
Contact
Repeat for each link. This is no more work than adding a ref= to each link.

Resources