Using Google Analytics to Track PDF Views

Last Updated on Saturday, 23 February 2013 01:37 Written by David Bauernschmidt Wednesday, 27 February 2013 12:00

I currently build and manage a pro-bono site for Greenwood Christian Academy where they have a lot of PDF documents.  The users click on documents for enrollment, calendars, educational forms, health documents, etc.  Just recently they also announced an event that offers sponsorships.  The question that has come up lately is how to use Google Analytics to track how many people view the pdf documents and how many people click on the sponsor links.  This may sound simple but then I realized that Google does not track counts for links that go away from the site or to pdf views.  Not accepting this as failure, I started looking around and came across a “cool” feature that Google offers called ‘_trackEvent’.  You can use this for a multitude of things but I believe this is what I need.  The key is to realize that you need to attach something to the <a href> before the actual redirect.  Since I always use the pdf and external links with a target=’_blank’ I decided to attach an event handler to the <a href>.  The problem is this could take a while, especially if you have a lot of links and pdf.  Thank goodness for jquery.  I attached the code below as close to the end of the page as possible (preferably right before the </body>).  This script attaches a click event to every <a href> if there is a target=’_blank’.  I then determine if it is a pdf or just a “plain” link.

Learn More

How to Set the Default Page in web.config

Last Updated on Saturday, 16 February 2013 11:36 Written by David Bauernschmidt Saturday, 16 February 2013 12:00

On most hosted sites the vendor does not allow you to directly make changes to IIS, instead they normally give you some sort of control panel or user interface to do all that you need. The down side is that you normally have to go to each tab or screen make the change and then wait or restart IIS to see the changes. Although this is fine in most cases there are times when you constantly make the same changes to each site you deploy. Until IIS 7 you were hard pressed to do anything other than contact provider to make the changes for you.

Along came IIS 7 with the distributed configuration options. This allows you to make changes to the server without having permission to directly effect IIS. If you put these settings into a web.config file that runs on something less than IIS 7 the server will ignore these setting so you will be fine.

Learn More

How to Use Microsoft SQL 2012 to Connect to Your Server

Last Updated on Monday, 21 January 2013 02:19 Written by Rodolfo Hernandez Tuesday, 29 January 2013 12:00

In this video, brought to you by Arvixe, I will give you a step by step guide on how to use Microsoft SQL 2012 to connect to your server:

Looking for quality ASP Web Hosting? Look no further than Arvixe Web Hosting!

Happy Hosting!

Rodolfo Hernandez

Learn More

Holy Crap, Google Just Blocked My Site!

Last Updated on Thursday, 24 January 2013 11:53 Written by Brent Riggs Thursday, 24 January 2013 11:53

So I’m kicked back one day enjoying a relaxing and peaceful afternoon when all of a sudden I get an email that one of the primary pages has been blocked by Google. And it’s on the website that funds my entire business .

Panic would be an understatement.

The site has thousands of users and the emails start flooding in from irate users. I have no clue why my page had been blocked or “suspected of malware”. I dove into the page code only to be more puzzled because it was a simple page:

  • A blog reader clicks on a link
  • That link goes to an intermediate page
  • A “click counter” is ticked off in the database
  • The reader is redirected to the destination URL

About 10 lines of code and I’m getting an ulcer trying to figure out how this could be hacked or malicious. The code uses an “id” from the querystring. No problem… the code checks to make sure the “id” has not been tampered with. It also checks for any additional variables that have been added.  If the “id” doesn’t exist in the database, nothing happens.  Fool proof… which makes the whole thing maddening.

I just cannot figure out why Google is blocking me. Yep, that’s my site in the graphic below (www.linkytools.com)… talk about the kiss of death. Bloggers will spread that kind of information like wildfire:

After couple of valium, some logic set in: it must be the target site being redirected to because I know the “malware” is not on mine. So why is “www.linkytools.com” getting the bad wrap by Google?

Using the “id” in the offending link from my click-counting page, I got in my database and found the destination URL.  Imagine my relief when I visited that URL and found out I was right. THEY were problem, not Linky Tools:

Linky Tools

I could rest easy that is was not my site but I was still left with how to fix things where 1) the click is tracked, 2) the redirect occurs and 3) if a bad site is encountered, Linky Tools is not listed as the culprit.  I had several options for redirecting in my .NET environment:

  • Response.redirect – would not fix the “blame Linky Tools” issue and it’s not a permanent redirect so the end users don’t get any link love
  • Response.PermanentRedirect – users get credit for the link in search engines and ranking but does not solve the “blame Linky Tools for the malware” problem
  • HTML Meta-refresh – solves the bad site message but gives no link love (not a permanent redirect)

The solution was using the response headers.  The following code is not .NET or VB peculiar. All the webdev platforms can use some version of this; it is the process of sending page headers to the final HTML output:

  • Response.Status = “301 Moved Permanently”
  • Response.AddHeader(“Location”, “http://” & whateveryoururlis)
  • Response.End()

Send these headers to your page when it loads. The “Status” takes care of making the redirection permanent so your end users get the linking credit they crave from search engines. “AddHeader” allows you to add the redirection (“Location”) and the URL to send the page to.  ”End” stops any additional processing.

Works perfect.  Using this method, I don’ t have to worry about anything on the hundreds of thousands of destination URLs in my database causing me another Google-banned-me-coronary-arrest.  I can’t risk having any more episodes of Judge Judy interrupted like that.

Learn More

How to Determine If a User is Accessing a Web Site Through a Mobile Device

Last Updated on Wednesday, 23 January 2013 12:51 Written by David Bauernschmidt Wednesday, 23 January 2013 12:00

With the explosion of smartphones, tablets and other handheld devices it is becoming more important than ever to determine what type of devices are being used to get to your data.  Furthermore; hiring a development team to build the same application for Apple, Android, and Microsoft is almost only dedicated to companies that are very large or those companies that are willing to lose money until they hit it big.  For the vast majority a solution is to develop a web application that fairly browser independent.  This article is not designed to show you how to build a mobile application (this might come in a later blog) but rather provide you with the first step in this journey.  This sample is to help in identifying whether a user is on your site by a mobile device or through a normal browser.  I have pulled together different parts of the web to provide step by step instructions to do the following:

Learn More

Search

Authors

Web Hosting

Linux Hosting
ASP .NET Hosting
Business Hosting
Reseller Hosting
E-Commerce Hosting
Dedicated Servers

Acceptable Use Policy
Terms of Service
Privacy Policy

Affiliate Program
Site Map

Blog Hosting

PostNuke Hosting
WordPress Hosting
b2evolution Hosting
Textpattern Hosting
Habari Hosting


CMS Hosting

CMS Made Simple Hosting
phpNuke Hosting
Geeklog Hosting
phpWCMS Hosting
phpWebSite Hosting
Shopping Cart Hosting

OpenCart Hosting
osCommerce Hosting
CubeCart Hosting
Buy Safe Hosting
Zen Cart Hosting


Video Sharing Software Hosting

iVidPlay Hosting
ClipBucket Hosting
ClipShare Hosting
osTube Hosting
vShare Hosting
Forum Hosting

XMB eXtreme Hosting
phpBB Hosting
Simple Machines Hosting
Vanilla Forum Hosting
AEF Hosting


Social Network and Community Website Hosting

SocialEngine Hosting
Jcow Hosting
Skadate Hosting
Dolphin Hosting
Elgg Hosting
Copyright © 2003-2013 Arvixe, LLC. All trademarks are property of their legal owner.