Can I stop robots from ruining statistics in Google Analytics? - php

I use Google Analytics to get visitors statistics on my webiste (PHP) and I see that a lot of traffic comes from sites like share-buttons.xyz, traffic2cash.xyz and top1-seo-service.com. I think this is because I use SEO-firendy URL:s (for looks in the addess bar).
This is not really a problem for the site itself, but when I look at the statistics in Google Analytics it includes these robots and non-users and the numbers are therefore not true.
Is there a way to block these robots or do I have to subtract the robots visits from the statistics manually every time I want a report?

If you see this happening you can prospectively exclude them from all future reports in GA by using a filter on that view (admin - filters, create filter, then apply to specific view)
If you specifically want to do it proactively using PHP then you could use some regex to match undesirable referrers in request headers and return nothing.

The answer to the main question is yes, but it requires to be be persistent and it is basically an ongoing task that you will need to perform. Yes, I know is a pain.
Just to let you know this has nothing todo with PHP or your friendly URL, your website is being a victim of what is known as ghost referrals. Google has not publicly said anything on the topic but just recently I found this article reporting that Google has finally found a solution here.
However, I choose to be sceptical about this. In the mean time this is what you need to do:
Make sure to leave a view untouched without any filters (Read the fourth paragrah)
In Google Analytics > admin > view > View Settings> Check "Exclude all hits from known bots and spiders" like this.
In the same view block spam bots: a) Check the list of ghost referrals in YOUR REPORT following this method and b) Create a filter like this.
I recommend you to read this article in full that contains lots of details and more information.
Some people like to create filters with Regex listening all the spammy bots, if you want to check a up to date list visit this repository.

Related

Automatically Post to Google + Business Page

Is it possible to post to Google + through PHP using some kind of API? I've read many conflicting statements on various places, including here on SO.
I've read that you need an analytics account, that you need to add a website to your page, that it isn't possible, that it's a closed service and you must apply, that you need your GMail username & password .etc.
Just really looking for a bit of clarity really. Found this, but I'm not sure if it allows this functionality. The lack of documentation really makes it quite daunting looking into this as well, there is literally nothing I can find at all.
Another option I've found appears to work, however it was from a website where you must pay to download the API. I'm genuinely not sure how or if it can be done.
Google restrict this API to whitelisted partners and companies through https://developers.google.com/+/web/api/rest/pages-signup
You could however use a third party script such as https://gist.github.com/zachbrowne/3301749 which handles the posting as if it was a logged in front end user rather than a direct API update flow.

Advertising or redirecting to new website

The website of our institution supports 30 languages and it has almost 400,000 articles. It's Global Rank in alexa.com is always between 11000 to 11500 and we are always on the top 5 google result if any body search on what we are working. Every day we receive almost 200 emails from people all around the world.
We recently developed a new version of our website by Drupal with a slightly different URL.
The old url is like this example.com/html/LANGUAGE/... but the new one is LANGUAGE.EXAMPLE.COM so we need to somehow tell current users to visit the new website without loosing our Global and Google rank.
The most straightforward solution is to modify the header of our website and ask the users to visit the new one but our chief ask me to examine the redirecting method and see what the conclusions of doing this is going to be.
I would like to know If I redirect every example.com/html/LANGUAGE/* to LANGUAGE.example.com will this effect our Global Rank on Google? Won't this redirection to the front page be a negative factor in Google? like 403 redirect? or Is there any better solution for our problem?
Note: There is no logical relationship between the content of old website to the new one. I mean there is no mapping between the contents so when a user visits a content in old website there is no way to redirect him to new website of the same content. He must be redirected to the front page
Thanks.
First of all Alexa rank related with your traffic data but Google PageRank calculating with various factors.
Positive factors are; backlinks, high traffic, correctly written meta tags, meta tags should be related with your body content etc.
Negative factors are; broken links, unrelated keywords, unexpected page content changes etc.
On your situation;
First you should definitely redirect all of your pages to new
destination.
Access to Google Web Master Tools Console.
Send sitemap of your new website.
Checkout Crawling Errors tab and correct the issues.
You won't face a huge impact on Alexa Rank if you redirect all of your pages correctly
Checkout Google Index > Content Keywords you should arrange your new website protecting these keyword chart.
I think Google Web Master Tools is crucial for you. As I said you can't do much things for Alexa Rank.
*I don't recommend you to empty your parent domain and using a subdomain. Subdomain is here for secondary contents.

What is the best solution to show different styles depending on the weather in the users location?

I am developing a website and Facebook application for a friend who runs a gardening services and does some handy-man servicing and would like some help to do the following;
I would not only like to do this on my Facebook application which is fairly similar to the website itself just a little more integration with Facebook, posting to wall and whatnot, but on the main website too. The reason why I have mentioned this is, as you may or may not know, one way of having an application on Facebook is to tell Facebook where the directory is and whatever on that directory on wards is shown in an iframe.
With Facebook going to my chosen directory and showing this on Facebook via an iframe, well, I don't exactly know what goes on, if they're on my website as well as Facebook or whatnot and due to being fairly new to the likes of PHP, I do apologize if this question seems a little messy but I do hope I do explain myself.
I've been told that the best option is to use HTML5 Geolocation as my primary method with a fallback to a better IP geolocator is my best option to find out their location, then I would like to check their current weather via the Met Office website ( http://www.metoffice.gov.uk/datapoint/product/uk-3hourly-site-specific-forecast/detailed-documentation ) to then know what stylesheet should be used.
Different stylesheets are being developed for most conditions such as; Showers, Heavy Rain, Overcast, Sunny, Snow and so on until they are all developed to customize the experience for the user and to also show different div's depending on their weather and show them their forecast. An example of a div could be; if it's snowing, it would ask them if they would want any snow to be ploughed.
Lastly, something I should have also asked and mentioned earlier, I would also like this feature to work for UK users to avoid any confusion and if it is possible to see how far the user is from where they are based as he has only told me he'll do up to a 100 mile radius and if it helps him pay for his bills and whatnot he'll go there, but is there a way to check how far away they are for a contact form or to show on screen or whatnot.
Summary:
Show different graphics depending on their location's weather and to see how far they are away from the base and show their weather forecast and if possible to change the weather upon the 3 hourly update.
Inform non-UK users that this is a UK only business and it would cost too much to go there.
Best Regards,
Tim
You can achieve by using the IP address of your visitor, then tracing down the location of the user. After the location is found out, use any weather report server like Google to get the weather of that location. Using the value returned by the provider, you can use the server side script to change the layout or contents of the page.
It can be a hassle, and might reduce the page load time due to extended time taken to contact and wait for response from the weather report provider.
PS: Suggestions and improvements expected.

Facebook API. Remove tags, wallposts, messages from a certain user

I'd like to remove as much as possible of my history with a certain facebook user via the Facebook API.
I want to be able to remove photo tags, wallposts, messages that I am tagged in, or associated with the certain user.
Is this possible, and if yes; how?
Blocking the user will go a long way towards removing most connections with the person in quesion. Go to Account->Privacy Settings->Manage Block Lists, or go to the users profile and look for the "Report/Block" link under their friends/family lists.
This FAQ about blocking describes a little about what happens when you block someone. As far as photos goes, it's a little unclear:
Photos: If the blocked person tagged you in any photos before the block, you’ll still be able to see those photos. You might also see photos of the blocked person if they are tagged in another friend’s album, but you won’t be able to click on their name to see their profile.
You do automatically get un-tagged from all their photos when you block someone. I'm guessing wall posts you're tagged in are removed as well, although I only tested with photo tags.
As far as removing their posts to your wall, as Igy pointed out you can't write an app that uses the API to delete posts that it didn't create. So, what I would do is write an app that gets all the posts on your wall and filters them, something like this pseudo-code:
posts = api('/me/feed')
for each post in posts:
if post.from.id == [blocked persons id]:
output post.id
Post ID's from the Graph API are in the format USERID_POSTID, so there are two ID's separated by an underscore. So for each ID in the output, go to https://www.facebook.com/permalink.php?story_fbid=[POSTID]&id=[USERID] and manually delete the post by selecting "Remove post" from the little gear menu on the top right of the post. Use the paging data from your API request, or until and since parameters (which are just UNIX timestamps, or any string accepted by the strtotime function), as described on http://developers.facebook.com/docs/reference/api/ under "Paging", to get all posts going back until the beginning of your wall.
If you are wanting to automate this process to make it available to end users and not just yourself, there are technically several ways you could go about it, although they may or may not violate (Terms of use)[http://www.facebook.com/terms.php]:
[3.2] You will not collect users' content or information, or otherwise access Facebook, using automated means (such as harvesting bots, robots, spiders, or scrapers) without our permission.
I'm sure there are ways of implementing such an app that doesn't violate these terms, for example providing a link to the post so that they can delete it themselves, rather than automatically deleting them.
http://suicidemachine.org/
I'd look into their code.
From their FAQ on if you can make your own:
Theoretically yes! Practically no (or let's say, not yet)! You'd need a Linux WebServer (apache2) with perl and python modules (php should be installed as well). Further, you'll need VNC-server and Java packages by Sun to launch selenium-remote applets. If you feel like contributing and can convince us with decent programming skills, please get in contact with us via email. We don't make the source code publicly available, since Facebook, Twitter, Myspace and LinkedIn would figure out how the suicidemachine is working in detail! So, please do not contact us, if you work for one of these companies!
I'm not even sure (personally) why you'd want to do this, surely you'd either want to block the other user or just remove them as a friend, but to answer your question:
It's not possible to delete most types of content via the API unless the App ID you're using was the original creator of that content (e.g an app for posting to your wall can delete the posts it made, but not posts made by other apps or on the Facebook.com interface)
Check the documentation at http://developers.facebook.com/docs/reference/api/ - you can definitely remove likes and comments of photos and wall posts - there may be other ways to do this (e.g retroactively changing your RSVP status to an event both users went to)

Restricting JS links from search engine's crawling

I would like to prevent google from following links I have in JS.
I didn't find how to do that in robots.txt
Am I looking in the wrong place?
Some more information:
I'm seeing google is crawling those pages although the links only appear in JS.
The reason I don't want him to crawl is that this content depends on external API's which I don't want to waste my rate limit with them on google crawlers and only per user demand
Direct from google ->
http://www.google.com/support/webmasters/bin/answer.py?answer=96569
Google probably won't find any links you have hidden in JS, but someone else could link to the same place.
It isn't links that matter though, it is URLs. Just specify the URLs you don't want search engines to visit in the robots.txt. The fact that you usually expose them to the browser via JS is irrelevant.
If you really want to limit access to the content, then just reducing discoverability probably isn't sufficient and you should put an authentication layer (e.g. password protection) in place.

Categories