Saturday 1 February 2014

Trick to Add Google Analytics to a Mobile Site

Mobile phone usage has exaggerated over years and folks are using mobile phones for looking close places. Whether it's building or shopping center or one thing else everybody ought to have a mobile web site or on-line presence to extend sales and connect with their customers.

Traffic tacking of mobile web site in Google Analytics different from tracking a standard web site as a result of Google Analytics uses JavaScript primarily based code to trace site viewers data however some mobile devices doesn't support JavaScript. Therefore Google devised a brand new way to track mobile websites using Google Analytics. This post can give you info on Google Analytics Mobile tracking Code and steps to put in it on your mobile web site.

To track a mobile website based on PHP, you need to add a block of PHP code before the <HTML> tag on all of your mobile pages. You need to conjointly add alittle block of PHP code forthwith before the closing </BODY> tag.All this is same for jsp, aspx or pl mobile websites.

In the primary block of PHP code, you’ll notice that you simply ought to add your internet Property account number very above in the block. You’ll conjointly ought to modification the path to the ga.php file to match your web site architecture.

You can see that the second block of PHP code is far easier. it's merely 2 lines of PHP code that reference a function within the initial block of code:

When each block of PHP works for you, the result's a picture tag at the lowest of each page on your mobile web site. The resulting hypertext mark-up language looks one thing like this:


Procedural steps to Install Google Analytics Traffic Tracking Code for Mobile Site:

1. First of all download the mobile tracking application from Google Analytic's site SITE LINK.

2.  Now extract the file googleanalyticsformobile.zip then copy ga.php or(ga.aspx, ga.jsp, ga.pl or etc) now paste it in the root of your site.

3. You should have your google analytics account so create for a mobile site from here. Now click on "Tracking for a new domain"and then enter your mobile site name. You should keep your web property id (e.g: UA-6543-21) but do not download the tracking code which is based on JavaScript.

4. There ought to be two files which have an extension of .snippet. Now open the first file i.e (php1.snippet) in notepad and enter the Web Property ID from point 1 in place of the text "Account ID goes here" , and replace the UA-xx with MO-xx.

5. Now copy the coding from the first snippet and paste it above of the opening <HTML> tag of every page you want to trace.

6. At length copy the coding from the second snippet and paste it at the lower of your page which you just want to trace.

No comments:

Post a Comment