<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2titles.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemtitles.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>jensbits</title>
	
	<link>http://www.jensbits.com</link>
	<description>my code snips</description>
	<lastBuildDate>Mon, 16 Apr 2012 14:19:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/jensbits" /><feedburner:info uri="jensbits" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by/2.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by/2.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><feedburner:emailServiceId>jensbits</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/jensbits" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2Fjensbits" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item>
		<title>Google Analytics Reporting API using OAuth 2 with ColdFusion</title>
		<link>http://feedproxy.google.com/~r/jensbits/~3/mkjxp4w_hKo/</link>
		<comments>http://www.jensbits.com/2012/04/05/google-analytics-reporting-api-using-oauth-2-with-coldfusion/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 14:56:53 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Google Analytics]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=1556</guid>
		<description><![CDATA[Google Analytics provides a Core Reporting API (Version 3) that allows for the extraction of data into custom dashboards and interfaces. The API uses OAuth 2 for authentication with refresh tokens for offline access. ColdFusion can tap into the API quite easily.
Related posts:<ol>
<li><a href='http://www.jensbits.com/2009/05/02/hooking-into-google-analytics-with-coldfusion/' rel='bookmark' title='Hooking into Google Analytics with ColdFusion'>Hooking into Google Analytics with ColdFusion</a></li>
<li><a href='http://www.jensbits.com/2009/12/19/coldfusion-and-google-analytics-getting-out-what-you-put-in/' rel='bookmark' title='ColdFusion and Google Analytics: Getting Out What You Put In'>ColdFusion and Google Analytics: Getting Out What You Put In</a></li>
<li><a href='http://www.jensbits.com/2009/05/10/google-analytics-api-login-authentication-with-coldfusion/' rel='bookmark' title='Google Analytics API Login Authentication with ColdFusion'>Google Analytics API Login Authentication with ColdFusion</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Google Analytics provides a <a href="http://code.google.com/apis/analytics/docs/gdata/home.html">Core Reporting API (Version 3)</a> that allows for the extraction of data into custom dashboards and interfaces. The API uses OAuth 2 for authentication with refresh tokens for offline access. There is also OAuth 1 with an API key access available for certain situations (not covered in this post):</p>
<blockquote><p>If your application has certain unusual authorization requirements, such as logging in at the same time as requesting data access (<a href="https://developers.google.com/accounts/docs/OpenID#oauth">hybrid</a>) or domain-wide delegation of authority (<a href="https://developers.google.com/accounts/docs/OAuth#GoogleAppsOAuth">2LO</a>), then you cannot currently use OAuth 2.0 tokens. In such cases, you must instead use OAuth 1.0 tokens and an API key. You can find your application&#8217;s API key in the Google APIs Console, in the Simple API Access section of the API Access pane. </p></blockquote>
<p>For everything else, here are the first steps, a <a href="http://www.cf-jensbits.com/demos/cf/ga/">demo</a>, and a link to the <a href="https://github.com/jensbits/Google-Analytics-Data-Export-API-with-ColdFusion">full code on github</a>.</p>
<h2>Steps</h2>
<ol>
<li><a href="https://code.google.com/apis/console/#access">Register the app with Google</a></li>
<li>Create login URL and retrieve &#8220;code&#8221;</li>
<li>Exchange &#8220;code&#8221; for access token</li>
<li>Send access token with API requests (<a href="http://www.jensbits.com/2011/12/29/google-api-requests-with-oauth-2-0-access-token/">details in this post</a>)</li>
</ol>
<p>Google details the instructions in <a href="http://code.google.com/apis/accounts/docs/OAuth2.html">Using OAuth 2.0 to Access Google APIs</a>.  </p>
<p>Steps for registering your app can be found in <a href="http://code.google.com/p/google-api-php-client/wiki/OAuth2">APIs Client Library for PHP</a>. </p>
<p>Google scope values for its API&#8217;s can be found in the <a href="https://code.google.com/oauthplayground/">OAuth 2.0 Playground</a>.</p>
<h2>Create Login URL and Retrieve &#8220;Code&#8221;</h2>
<h3>Parameters for Login URL</h3>
<p>Client id and client secret are set by Google when the app is registered for api access in the <a href="https://code.google.com/apis/console/#access">Google APIs Console</a>. </p>
<p>The redirect uri is a location on the server that the user is sent to after authenticating. This uri is registered in the Google APIs Console during app registration.</p>
<p>These values can be included in the application.cfc:</p>
<pre class="brush: coldfusion; title: ; notranslate">
&lt;cfset request.oauthSettings = {scope = &quot;https://www.googleapis.com/auth/analytics.readonly&quot;,
      client_id = &quot;YOUR-CLIENT-ID.apps.googleusercontent.com&quot;,
      client_secret = &quot;YOUR-CLIENT-SECRET&quot;,
      redirect_uri = &quot;YOUR-REDIRECT-URI&quot;,
      state = &quot;optional&quot;} /&gt;
</pre>
<h3>User Login URL</h3>
<p>The login URL will prompt the user for permission to access their Google content via the app and  a &#8220;code&#8221; request variable will be returned in the URL. See <a href="http://code.google.com/apis/accounts/docs/OAuth2Login.html#formingtheurl">Forming the URL</a> for more detailed information.</p>
<pre class="brush: coldfusion; title: ; notranslate">
&lt;!--- create login url ---&gt;
&lt;cfset loginURL = &quot;https://accounts.google.com/o/oauth2/auth?scope=&quot; &amp; request.oauthSettings[&quot;scope&quot;]
                   &amp; &quot;&amp;redirect_uri=&quot; &amp; request.oauthSettings[&quot;redirect_uri&quot;]
                   &amp; &quot;&amp;response_type=code&amp;client_id=&quot; &amp; request.oauthSettings[&quot;client_id&quot;]
                   &amp; &quot;&amp;access_type=online&quot; /&gt;

&lt;a href=&quot;#loginURL#&quot;&gt;Login with Google account that has access to analytics&lt;/a&gt;
</pre>
<h2>Exchange &#8220;Code&#8221; for Access Token</h2>
<p>If access type was set to &#8220;offline&#8221; in the login URL, a refresh token will be sent with the access token so the data can be accessed without prompting the user again. Refesh token storage and use will be covered in another post.</p>
<pre class="brush: coldfusion; title: ; notranslate">
&lt;!--- get access token if code returned and access token not issued ---&gt;
&lt;cfif isDefined(&quot;URL.code&quot;) AND URL.code NEQ &quot;access_denied&quot;&gt;
&lt;cfinvoke component=&quot;ga&quot; method=&quot;googleOauth2Login&quot;&gt;
        &lt;cfinvokeargument name=&quot;code&quot; value=&quot;#URL.code#&quot; /&gt;
    &lt;/cfinvoke&gt;
&lt;/cfif&gt;

----- in component -----

&lt;cffunction name=&quot;googleOauth2Login&quot; access=&quot;public&quot; hint=&quot;GA account authorization&quot;&gt;
        &lt;cfargument name=&quot;code&quot; type=&quot;string&quot; required=&quot;yes&quot; default=&quot;&quot;&gt;
        &lt;cfargument name=&quot;gaOauthUrl&quot; type=&quot;string&quot; required=&quot;no&quot; default=&quot;https://accounts.google.com/o/oauth2/token&quot;&gt;
        &lt;!---cfscript provides cleaner local var set---&gt;
        &lt;cfscript&gt;
			var jsonResponse = StructNew();
			var accessToken = &quot;&quot;;
			var expires_in = &quot;&quot;;
		&lt;/cfscript&gt;

        &lt;cfhttp url=&quot;#arguments.gaOauthUrl#&quot; method=&quot;post&quot;&gt;
       		&lt;cfhttpparam name=&quot;code&quot; type=&quot;formField&quot; value=&quot;#arguments.code#&quot;&gt;
       		&lt;cfhttpparam name=&quot;client_id&quot; type=&quot;formField&quot; value=&quot;#request.oauthSettings['client_id']#&quot;&gt;
       		&lt;cfhttpparam name=&quot;client_secret&quot; type=&quot;formField&quot; value=&quot;#request.oauthSettings['client_secret']#&quot;&gt;
       		&lt;cfhttpparam name=&quot;redirect_uri&quot; type=&quot;formField&quot; value=&quot;#request.oauthSettings['redirect_uri']#&quot;&gt;
       		&lt;cfhttpparam name=&quot;grant_type&quot; type=&quot;formField&quot; value=&quot;authorization_code&quot;&gt;
		&lt;/cfhttp&gt;

        &lt;cfset jsonResponse = DeserializeJSON(cfhttp.filecontent) /&gt;
        &lt;cfif StructKeyExists(jsonResponse, &quot;access_token&quot;)&gt;
	        &lt;cfset accessToken = jsonResponse.access_token /&gt;
	        &lt;cfset expires_in = jsonResponse.expires_in /&gt;
        &lt;cfelse&gt;
         	&lt;cfset accessToken = &quot;Authorization Failed &quot; &amp; cfhttp.filecontent /&gt;
        &lt;/cfif&gt;

        &lt;cflock scope=&quot;session&quot; type=&quot;exclusive&quot; timeout=&quot;5&quot;&gt;
			&lt;cfset session.ga_accessToken = accessToken /&gt;
			&lt;cfset session.ga_accessTokenExpiry = DateAdd(&quot;s&quot;,expires_in,Now()) /&gt;
		&lt;/cflock&gt;
		&lt;!---send back to login to show auth error message or profile select options---&gt;
		&lt;!---this also strips code URL param to prevent inadvertent refresh with one-time use code---&gt;
		&lt;cflocation url=&quot;login.cfm&quot; addtoken=&quot;no&quot;/&gt;
    &lt;/cffunction&gt;
</pre>
<p>You now have an access token to present to the Google Analytics API (or any Google API you specify in the scope) and now you can request the data.</p>
<p>Full demo and code below:</p>
<p id="demo"><a href="http://www.cf-jensbits.com/demos/cf/ga/" onclick="_gaq.push(['_link', 'http://www.cf-jensbits.com/demos/cf/ga/']); return false;"><span>Demo</span></a></p>
<p id="download"><a href="https://github.com/jensbits/Google-Analytics-Data-Export-API-with-ColdFusion"><span>Download code</span></a></p>
<p class="donate">If this post helped you out, please consider donating to help pay the hosting fees. 100% of the donations go to the web host.</p>

<!-- Begin PayPal Donations by http://wpstorm.net/ -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="jen@jensbits.com" /><input type="hidden" name="return" value="http://www.jensbits.com/thank-you/" /><input type="hidden" name="item_name" value="All donations go to hosting fees for this site." /><input type="hidden" name="currency_code" value="USD" /><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
<!-- End PayPal Donations -->

<p>Related posts:<ol>
<li><a href='http://www.jensbits.com/2009/05/02/hooking-into-google-analytics-with-coldfusion/' rel='bookmark' title='Hooking into Google Analytics with ColdFusion'>Hooking into Google Analytics with ColdFusion</a></li>
<li><a href='http://www.jensbits.com/2009/12/19/coldfusion-and-google-analytics-getting-out-what-you-put-in/' rel='bookmark' title='ColdFusion and Google Analytics: Getting Out What You Put In'>ColdFusion and Google Analytics: Getting Out What You Put In</a></li>
<li><a href='http://www.jensbits.com/2009/05/10/google-analytics-api-login-authentication-with-coldfusion/' rel='bookmark' title='Google Analytics API Login Authentication with ColdFusion'>Google Analytics API Login Authentication with ColdFusion</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/jensbits?a=mkjxp4w_hKo:D3s3G9MAxJ8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/jensbits?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=mkjxp4w_hKo:D3s3G9MAxJ8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/jensbits?i=mkjxp4w_hKo:D3s3G9MAxJ8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=mkjxp4w_hKo:D3s3G9MAxJ8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/jensbits?i=mkjxp4w_hKo:D3s3G9MAxJ8:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/jensbits/~4/mkjxp4w_hKo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2012/04/05/google-analytics-reporting-api-using-oauth-2-with-coldfusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.jensbits.com/2012/04/05/google-analytics-reporting-api-using-oauth-2-with-coldfusion/</feedburner:origLink></item>
		<item>
		<title>Tracking Multiple Domains Individually and as a Group in Google Analytics</title>
		<link>http://feedproxy.google.com/~r/jensbits/~3/ZMjlf-yHad0/</link>
		<comments>http://www.jensbits.com/2012/03/28/tracking-multiple-domains-individually-and-as-a-group-in-google-analytics/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 17:56:15 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[Google Analytics]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=1535</guid>
		<description><![CDATA[Website managers who track multiple top-level domains individually but also want to track some or all of them as a group in one profile can do so with the proper tracking code installed.
Related posts:<ol>
<li><a href='http://www.jensbits.com/2011/06/06/google-analytics-click-event-tracking-on-linkbutton-in-asp-net-vb/' rel='bookmark' title='Google Analytics Click Event Tracking on LinkButton in ASP.NET (VB)'>Google Analytics Click Event Tracking on LinkButton in ASP.NET (VB)</a></li>
<li><a href='http://www.jensbits.com/2010/02/01/google-analytics-third-party-shopping-cart-cross-domain-tracking-using-traditional-and-asynchronous-snippet/' rel='bookmark' title='Google Analytics Third-Party Shopping Cart (Cross-Domain) Tracking Using Traditional and Asynchronous Snippet'>Google Analytics Third-Party Shopping Cart (Cross-Domain) Tracking Using Traditional and Asynchronous Snippet</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Website managers who track multiple top-level domains individually but also want to track some or all of them as a group in one profile can do so with the proper tracking code installed.</p>
<p>Say you have multiple sites that you manage: site1.com, site2.com, and site3.com.</p>
<p>You want each to have their own analytics profile that the site owner&#8217;s can access. You also want to dump all three sites into a single profile as an aggregate. Useful for saying things like, &#8220;I manage three site that get X amount of traffic.&#8221; Or, for seeing the totals on web stats that all sites impact. For example, sports-car-shirts.com and ferrari-shirts.com. How many ferrari shirts were sold on both sites? Easy to determine if they dump into the same profile.</p>
<h2>Create the Accounts</h2>
<p>Google Analytics (GA) consists of <strong>Accounts</strong> which contain one or more <strong>Profiles</strong>. </p>
<p>Accounts have an alphanumeric account ID associated with them in the form of UA-1233456-1. This is placed in the tracking code as <code>_gaq.push(['_setAccount', 'UA-1234567-1']);</code></p>
<p>Profiles have a numeric profile ID that is sometimes referred to as the table ID. It can be found by going to Admin (upper left) and clicking on Profile Settings under the profile name. It will be listed as Profile ID. The Profile ID is not needed to set up the tracking.</p>
<p>Account ID (tracking code <code>_setAccount</code>): UA-1234567-1<br />
Profile ID (also known as table ID): 12345678</p>
<p>One Account can have multiple Profiles with distinct Profile IDs.</p>
<p><a href="http://support.google.com/analytics/bin/answer.py?hl=en&#038;answer=1009618">GA docs illustrate this</a> as:<br />
<img src="http://www.jensbits.com/wp-content/uploads/2012/03/diagAccountWebPropProfile.png" alt="" title="diagAccountWebPropProfile" width="414" height="390" class="size-full wp-image-1536" /></p>
<p><span class="shout">When you create a new GA Account, always, always, always create <strong>2</strong> profiles.</span> That goes for every Account you set up. Create a base or &#8220;raw&#8221; profile and don&#8217;t ever touch it again. <em>Look but don&#8217;t touch.</em> Create a second &#8220;default&#8221; profile that you apply filters to and perform all other sorts of magic. If the &#8220;default&#8221; profile ever gets messed up by a filter or other unintended consequences, you still have all your data in the &#8220;raw&#8221; profile.</p>
<p>Profiles are the &#8220;buckets&#8221; that data gets dumped into. They can contain all the data or a portion based on filters.</p>
<h2>Tracking</h2>
<p>Using the example of three (3) separate sites, we will have four (4) separate accounts each with two (2) profiles in them (raw and default). One Account for each of the sites and one for the aggregate. Sounds like a lot but don&#8217;t worry; this is easy and quick.</p>
<p>The site owners will get access to the &#8220;default&#8221; profile of the account respective to their website.</p>
<p>For each of the three sites, add the tracking code with multiple trackers. One will track the site individually, one will dump into the aggregate account.<br />
<code><br />
  var _gaq = _gaq || [];<br />
  _gaq.push(<br />
  ['_setAccount', 'UA-XXXXX-1'],<br />
  ['_trackPageview'],<br />
  ['aggregate._setAccount', 'UA-XXXXX-2'],<br />
  ['aggregate._trackPageview']<br />
  ); </p>
<p>  (function() {<br />
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;<br />
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';<br />
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);<br />
  })();<br />
</code></p>
<p>The multiple tracker puts the data in the site&#8217;s profile first and then puts the data into the aggregate account. </p>
<p>Place this code on all three accounts swapping out the site&#8217;s account number as appropriate.</p>
<p>Once it is all set up, put a filter on the &#8220;default&#8221; profile of the aggregate account to display the domain name in the reports. Leave the &#8220;raw&#8221; profile of all the accounts alone.  This will help you distinguish pages with the same name in the reports. For example, site1.com/contact.html and site2.com/contact.html. See <a href="http://code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html#profilesKey">Modify your cross-domain profile with a filter</a> to show the full domain in your content reports.</p>
<p><img src="http://www.jensbits.com/wp-content/uploads/2012/03/hostname-ga.gif" alt="" title="hostname-ga" width="576" height="477" class="alignnone size-full wp-image-1549" /></p>
<p>Check that data is being tracked by checking the &#8220;Tracking Status&#8221; in the Account Admin (Admin -> Tracking Code).</p>
<p>Check the data received in each account and profile the next day to make sure the appropriate data is being dumped where it should be and that you hostname filter in the aggregate profile is working properly.</p>
<p class="donate">If this post helped you out, please consider donating to help pay the hosting fees. 100% of the donations go to the web host.</p>

<!-- Begin PayPal Donations by http://wpstorm.net/ -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="jen@jensbits.com" /><input type="hidden" name="return" value="http://www.jensbits.com/thank-you/" /><input type="hidden" name="item_name" value="All donations go to hosting fees for this site." /><input type="hidden" name="currency_code" value="USD" /><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
<!-- End PayPal Donations -->

<p>Related posts:<ol>
<li><a href='http://www.jensbits.com/2011/06/06/google-analytics-click-event-tracking-on-linkbutton-in-asp-net-vb/' rel='bookmark' title='Google Analytics Click Event Tracking on LinkButton in ASP.NET (VB)'>Google Analytics Click Event Tracking on LinkButton in ASP.NET (VB)</a></li>
<li><a href='http://www.jensbits.com/2010/02/01/google-analytics-third-party-shopping-cart-cross-domain-tracking-using-traditional-and-asynchronous-snippet/' rel='bookmark' title='Google Analytics Third-Party Shopping Cart (Cross-Domain) Tracking Using Traditional and Asynchronous Snippet'>Google Analytics Third-Party Shopping Cart (Cross-Domain) Tracking Using Traditional and Asynchronous Snippet</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/jensbits?a=ZMjlf-yHad0:_4wqdl-mrzI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/jensbits?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=ZMjlf-yHad0:_4wqdl-mrzI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/jensbits?i=ZMjlf-yHad0:_4wqdl-mrzI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=ZMjlf-yHad0:_4wqdl-mrzI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/jensbits?i=ZMjlf-yHad0:_4wqdl-mrzI:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/jensbits/~4/ZMjlf-yHad0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2012/03/28/tracking-multiple-domains-individually-and-as-a-group-in-google-analytics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.jensbits.com/2012/03/28/tracking-multiple-domains-individually-and-as-a-group-in-google-analytics/</feedburner:origLink></item>
		<item>
		<title>stopPropagation and preventDefault jQuery Methods</title>
		<link>http://feedproxy.google.com/~r/jensbits/~3/tnhISEAq9yg/</link>
		<comments>http://www.jensbits.com/2012/03/05/stoppropagation-and-preventdefault-jquery-methods/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 18:19:11 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=1518</guid>
		<description><![CDATA[Simple demo of stopPropagation() and preventDefault() jQuery methods. Often these two methods are used together. And, often their function and use is confused or used when not needed thanks to copy and paste.
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Simple demo of stopPropagation() and preventDefault() jQuery methods. Often these two methods are used together. And, often their function and use is confused or used when not needed thanks to copy and paste.</p>
<h2>stopPropagation()</h2>
<p>stopPropagation() prevents events that are attached to elements from moving up the DOM to the parent. For example, if there is a link with a click method attached inside of a DIV or FORM that <em>also</em> has a click method attached, it will prevent the DIV or FORM click method from firing. <a href="http://api.jquery.com/event.stopPropagation/">jQuery docs on stopPropagation()</a>.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;parentDiv&quot;&gt;
    &lt;h1&gt;The Parent Div&lt;/h1&gt;
    &lt;p&gt;&lt;a href=&quot;http://api.jquery.com&quot; id=&quot;childLink&quot;&gt;Child Link&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</pre>
<pre class="brush: jscript; title: ; notranslate">
$(&quot;#parentDiv&quot;).click(function() {
    alert(&quot;Parent div click function called.&quot;);
});

$(&quot;#childLink&quot;).click(function(e) {
    // e = event
    e.stopPropagation();
    // click on this link will cause ONLY child to fire
    alert(&quot;Child link click function called.&quot;);
});
</pre>
<h2>preventDefault()</h2>
<p>preventDefault() prevents the default behavior of an element. It prevents a FORM from submitting, a link from loading a page, or a button from doing what it does. If an element does not have a default behavior for the method attached to it by jQuery then it is not needed. For example, if a click event is attached to a DIV element, preventDefault() is not needed. What is the default click behavior of a <em>simple</em> DIV element? Nothing. <a href="http://api.jquery.com/event.preventdefault/">jQuery docs on preventDefault()</a>.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;parentDiv&quot;&gt;
    &lt;h1&gt;The Parent Div&lt;/h1&gt;
    &lt;p&gt;&lt;a href=&quot;http://api.jquery.com&quot; id=&quot;childLink&quot;&gt;Child Link&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</pre>
<pre class="brush: jscript; title: ; notranslate">
$(&quot;#parentDiv&quot;).click(function() {
    // preventDefault() not needed in this case on the DIV
    alert(&quot;Parent div click function called.&quot;);
});

$(&quot;#childLink&quot;).click(function(e) {
    // e = event
    e.stopPropagation();
    // click on this link will cause ONLY child to fire
    e.preventDefault();
    // link will not proceed to HREF url
    alert(&quot;Child link click function called.&quot;);
});
</pre>
<h2>Demo</h2>
<p><iframe style="width: 100%; height: 325px" src="http://jsfiddle.net/jensbits/Lrrys/embedded/result,html,js" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p class="donate">If this post helped you out, please consider donating to help pay the hosting fees. 100% of the donations go to the web host.</p>

<!-- Begin PayPal Donations by http://wpstorm.net/ -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="jen@jensbits.com" /><input type="hidden" name="return" value="http://www.jensbits.com/thank-you/" /><input type="hidden" name="item_name" value="All donations go to hosting fees for this site." /><input type="hidden" name="currency_code" value="USD" /><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
<!-- End PayPal Donations -->

<p>No related posts.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/jensbits?a=tnhISEAq9yg:imkn9muztb0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/jensbits?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=tnhISEAq9yg:imkn9muztb0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/jensbits?i=tnhISEAq9yg:imkn9muztb0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=tnhISEAq9yg:imkn9muztb0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/jensbits?i=tnhISEAq9yg:imkn9muztb0:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/jensbits/~4/tnhISEAq9yg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2012/03/05/stoppropagation-and-preventdefault-jquery-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.jensbits.com/2012/03/05/stoppropagation-and-preventdefault-jquery-methods/</feedburner:origLink></item>
		<item>
		<title>Generate SQL Server Reporting Services (SSRS) Report as PDF from URL with VB.NET or C#.NET</title>
		<link>http://feedproxy.google.com/~r/jensbits/~3/ww7fFivLlRY/</link>
		<comments>http://www.jensbits.com/2012/01/23/generate-sql-server-reporting-services-ssrs-report-as-pdf-from-url-with-vb-net-or-c-net/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 20:55:32 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[reporting]]></category>
		<category><![CDATA[ssrs]]></category>
		<category><![CDATA[vb.net]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=1449</guid>
		<description><![CDATA[Generating an existing SQL Server Reporting Services (SSRS) report to a PDF via a web URL is a convenient way to distribute SSRS reports, invoices, or anything else from SSRS. This post focuses on an existing report; however, links to the basic set up for a report are included. The code to output an existing report as PDF are given and uses a ReportViewer control.
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Generating an existing SQL Server Reporting Services (SSRS) report to a PDF via a web URL is a convenient way to distribute SSRS reports, invoices, or anything else from SSRS. This post focuses on an existing report; however, links to the basic set up for a report are included. The code to output an existing report as PDF are given and uses a ReportViewer control.</p>
<p>You can skip to the PDF Output section if your server is all set up with the ReportViewer controls.</p>
<p>The pieces and parts to output an SSRS report as a PDF were culled from several disparate sources. All sources are given appropriate credit for their work. </p>
<p>As an added bonus, VB.NET and C#.NET versions are shown.</p>
<h2>Add Report Viewer Redistributable to Server</h2>
<p>The ReportViewer controls need to be installed on the server and <a href="http://www.microsoft.com/download/en/details.aspx?id=6576">Microsoft provides the redistributable for that in their download center</a>.</p>
<blockquote><p>
The Microsoft Report Viewer 2008 Redistributable Package includes Windows Forms and ASP.NET Web server controls for viewing reports designed using Microsoft reporting technology.</p></blockquote>
<h2>Add HTTP Handler Web Server</h2>
<p>The server has to know what it is dealing with when it is asked to generate a ReportViewer control. To help the server out, add the appropriate handlers.</p>
<p><a href="http://www2.briteglobal.com/en/blogs/Lists/Posts/Post.aspx?ID=15">Brite Global provides some excellent instructions</a> on how to add the handlers.</p>
<h2>Create Report on SSRS Server</h2>
<p>The <a href="http://www.datasprings.com/resources/articles-information/sql-server-reporting-services-getting-started">&#8220;Who Needs SQL Server’s Reporting Services?&#8221;</a> article by DataSprings is an excellent tutorial for getting started with your first report.</p>
<h2>Add Generic User to Report Server</h2>
<p>For security reasons, a generic user will need to be added to the SSRS server. These credentials will be used by the .aspx page to access the report. </p>
<p>Give this user &#8220;Browser &#8211; May view folders, reports and subscribe to reports&#8221; only rights.<br />
<img src="http://www.jensbits.com/wp-content/uploads/2012/01/ssrs_roles.gif" alt="" title="ssrs_roles" width="550" height="275"  /><br />
This generic (aka anonymous) user&#8217;s credentials will be stored in a separate config file and pulled into the web.config. That way if they change, you are not mucking about in the web.config file.</p>
<p>Create a appSetting.config and add the following information:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;appSettings&gt;
    &lt;add key=&quot;SSRS&quot; value=&quot;http://YOUR-REPORTSERVER-URL&quot; /&gt;
    &lt;add key=&quot;rvUser&quot; value=&quot;GENERIC-USERNAME&quot; /&gt;
    &lt;add key=&quot;rvPassword&quot; value=&quot;GENERIC-PASSWORD&quot; /&gt;
    &lt;add key=&quot;rvDomain&quot; value=&quot;YOUR-REPORTSERVER-DOMAIN&quot; /&gt;
  &lt;/appSettings&gt;
</pre>
<p>Pop it into the web.config as such:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;appSettings file=&quot;appSettings.config&quot;&gt;
&lt;!-- Could have other keys here --&gt;
&lt;/appSettings&gt;
</pre>
<p>The authorization is handled by using the <a href="http://msdn.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials%28v=vs.80%29.aspx">IReportServerCredentials Interface</a> which &#8220;allows applications to provide credentials for connecting to a Reporting Services report server.&#8221; </p>
<h2>PDF Output</h2>
<p>Add the ReportViewer control the an .aspx page by adding an assembly reference and the control itself:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;%@ Page Language=&quot;VB&quot; AutoEventWireup=&quot;false&quot; CodeFile=&quot;YOUR-FILE_NAME.vb&quot; Inherits=&quot;YOUR-INHERITS&quot; %&gt;

&lt;%@ Register Assembly=&quot;Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot;
    Namespace=&quot;Microsoft.Reporting.WebForms&quot; TagPrefix=&quot;rsweb&quot; %&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head runat=&quot;server&quot;&gt;
    &lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;
    &lt;div&gt;
        &lt;rsweb:ReportViewer ID=&quot;ReportViewer1&quot; runat=&quot;server&quot;&gt;
        &lt;/rsweb:ReportViewer&gt;

    &lt;/div&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The code behind page got a lot of help from <a href="http://beyondrelational.com/blogs/viral/archive/2010/07/09/generating-ssrs-reports-programatically.aspx">Viral at Beyond Relational&#8217;s post &#8220;Generating and exporting SSRS reports programatically using Report Viewer Control&#8221;</a> and using Microsoft&#8217;s <a href="http://msdn.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials%28v=vs.80%29.aspx">IReportServerCredentials Interface</a> that was mentioned earlier:</p>
<h3>VB.NET</h3>
<pre class="brush: vb; title: ; notranslate">
Imports System.Net
Imports System.IO
Imports System.Security.Principal
Imports Microsoft.Reporting.WebForms

Partial Class YOUR_PAGE_CLASS
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SetReportParameters()
    End Sub

    Private Sub SetReportParameters()
        'Set Processing Mode
        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
        ' Set report server and report path
        ReportViewer1.ServerReport.ReportServerUrl = _
           New Uri(SSRS)

        ReportViewer1.ServerReport.ReportPath = _
           &quot;/YOUR-REPORT-PATH&quot;

        Dim paramList As New Generic.List(Of ReportParameter)
        Dim pInfo As ReportParameterInfoCollection
        pInfo = ReportViewer1.ServerReport.GetParameters()

        'if you have report parameters - add them here
        paramList.Add(New ReportParameter(&quot;PARAM1-EXAMPLE&quot;, &quot;1&quot;, True))
        paramList.Add(New ReportParameter(&quot;PARAM2-EXAMPLE&quot;, &quot;2&quot;, True))

        ReportViewer1.ServerReport.SetParameters(paramList)

        ' Process and render the report
        ReportViewer1.ServerReport.Refresh()

        'output as PDF
        Dim returnValue As Byte()
        Dim format As String = &quot;PDF&quot;
        Dim deviceinfo As String = &quot;&quot;
        Dim mimeType As String = &quot;&quot;
        Dim encoding As String = &quot;&quot;
        Dim extension As String = &quot;pdf&quot;
        Dim streams As String() = Nothing
        Dim warnings As Microsoft.Reporting.WebForms.Warning() = Nothing

        returnValue = ReportViewer1.ServerReport.Render(format, deviceinfo, mimeType, encoding, extension, streams, warnings)
        Response.Buffer = True
        Response.Clear()

        Response.ContentType = mimeType

        Response.AddHeader(&quot;content-disposition&quot;, &quot;attachment; filename=YOUR-OUTPUT-FILE-NAME.pdf&quot;)

        Response.BinaryWrite(returnValue)
        Response.Flush()
        Response.End()
    End Sub

    Protected Sub Page_Init(ByVal sender As Object, _
                            ByVal e As System.EventArgs) _
                            Handles Me.Init

        ReportViewer1.ServerReport.ReportServerCredentials = _
            New MyReportServerCredentials()

    End Sub
End Class

&lt;Serializable()&gt; _
Public NotInheritable Class MyReportServerCredentials
    Implements IReportServerCredentials
    Public userName As String = ConfigurationManager.AppSettings(&quot;rvUser&quot;)
    Public password As String = ConfigurationManager.AppSettings(&quot;rvPassword&quot;)
    Public domain As String = ConfigurationManager.AppSettings(&quot;rvDomain&quot;)

    Public ReadOnly Property ImpersonationUser() As WindowsIdentity _
            Implements IReportServerCredentials.ImpersonationUser
        Get
            'Use the default windows user.  Credentials will be
            'provided by the NetworkCredentials property.
            Return Nothing
        End Get
    End Property

    Public ReadOnly Property NetworkCredentials() As ICredentials _
            Implements IReportServerCredentials.NetworkCredentials
        Get
            'Read the user information from the web.config file.
            'By reading the information on demand instead of storing
            'it, the credentials will not be stored in session,
            'reducing the vulnerable surface area to the web.config
            'file, which can be secured with an ACL.

            If (String.IsNullOrEmpty(userName)) Then
                Throw New Exception(&quot;Missing user name from web.config file&quot;)
            End If

            If (String.IsNullOrEmpty(password)) Then
                Throw New Exception(&quot;Missing password from web.config file&quot;)
            End If

            If (String.IsNullOrEmpty(domain)) Then
                Throw New Exception(&quot;Missing domain from web.config file&quot;)
            End If

            Return New NetworkCredential(userName, password, domain)

        End Get
    End Property

    Public Function GetFormsCredentials(ByRef authCookie As Cookie, _
                                        ByRef userName As String, _
                                        ByRef password As String, _
                                        ByRef authority As String) _
                                        As Boolean _
            Implements IReportServerCredentials.GetFormsCredentials

        authCookie = Nothing
        userName = Nothing
        password = Nothing
        authority = Nothing

        'Not using form credentials
        Return False

    End Function

End Class
</pre>
<h3>C#</h3>
<pre class="brush: csharp; title: ; notranslate">
using System;
using System.Configuration;
using System.Net;
using System.Security.Principal;
using Microsoft.Reporting.WebForms;
partial class YOUR_PAGE_CLASS : System.Web.UI.Page
{
    public string SSRS = ConfigurationManager.AppSettings[&quot;SSRS&quot;];
    protected void Page_Load(object sender, System.EventArgs e)
    {
        SetReportParameters();
    }
    private void SetReportParameters()
    {
        //Set Processing Mode
        //ReportViewer1.ProcessingMode = ProcessingMode.Remote
        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
        // Set report server and report path
        ReportViewer1.ServerReport.ReportServerUrl = new Uri(SSRS);

        ReportViewer1.ServerReport.ReportPath = &quot;/YOUR-REPORT-PATH&quot;;

        System.Collections.Generic.List&lt;ReportParameter&gt; paramList = new System.Collections.Generic.List&lt;ReportParameter&gt;();
        ReportParameterInfoCollection pInfo = default(ReportParameterInfoCollection);
        pInfo = ReportViewer1.ServerReport.GetParameters();

        //if you have report parameters - add them here
        paramList.Add(new ReportParameter(&quot;PARAM1-EXAMPLE&quot;, &quot;1&quot;, true));
        paramList.Add(new ReportParameter(&quot;PARAM1-EXAMPLE&quot;, &quot;2&quot;, true));

        ReportViewer1.ServerReport.SetParameters(paramList);

        // Process and render the report
        ReportViewer1.ServerReport.Refresh();

        //output as PDF
        byte[] returnValue = null;
        string format = &quot;PDF&quot;;
        string deviceinfo = &quot;&quot;;
        string mimeType = &quot;&quot;;
        string encoding = &quot;&quot;;
        string extension = &quot;pdf&quot;;
        string[] streams = null;
        Microsoft.Reporting.WebForms.Warning[] warnings = null;

        returnValue = ReportViewer1.ServerReport.Render(format, deviceinfo, out mimeType, out encoding, out extension, out streams, out warnings);
        Response.Buffer = true;
        Response.Clear();

        Response.ContentType = mimeType;

        Response.AddHeader(&quot;content-disposition&quot;, &quot;attachment; filename=YOUR-OUTPUT-FILE-NAME.pdf&quot;);

        Response.BinaryWrite(returnValue);
        Response.Flush();
        Response.End();
    }

    protected void Page_Init(object sender, System.EventArgs e)
    {
        ReportViewer1.ServerReport.ReportServerCredentials = new MyReportServerCredentials();

    }
    public YOUR-PAGE-CLASS()
    {
        Init += Page_Init;
        Load += Page_Load;
    }
}
[Serializable()]
public sealed class MyReportServerCredentials : IReportServerCredentials
{
    public string userName = ConfigurationManager.AppSettings[&quot;rvUser&quot;];
    public string password = ConfigurationManager.AppSettings[&quot;rvPassword&quot;];

    public string domain = ConfigurationManager.AppSettings[&quot;rvDomain&quot;];
    public WindowsIdentity ImpersonationUser
    {

        //Use the default windows user.  Credentials will be
        //provided by the NetworkCredentials property.

        get { return null; }
    }

    public ICredentials NetworkCredentials
    {

        get
        {
            //Read the user information from the web.config file.
            //By reading the information on demand instead of storing
            //it, the credentials will not be stored in session,
            //reducing the vulnerable surface area to the web.config
            //file, which can be secured with an ACL.

            if ((string.IsNullOrEmpty(userName)))
            {
                throw new Exception(&quot;Missing user name from web.config file&quot;);
            }

            if ((string.IsNullOrEmpty(password)))
            {
                throw new Exception(&quot;Missing password from web.config file&quot;);
            }

            if ((string.IsNullOrEmpty(domain)))
            {
                throw new Exception(&quot;Missing domain from web.config file&quot;);
            }

            return new NetworkCredential(userName, password, domain);

        }
    }

    public bool GetFormsCredentials(out Cookie authCookie,
               out string userName, out string password,
               out string authority)
    {
        authCookie = null;
        userName = null;
        password = null;
        authority = null;

        // Not using form credentials
        return false;
    }

}
</pre>
<p>Now just run your URL in a browser (http://YOUR-DOMAIN.com/YOUR-PAGE.aspx) and the File Download warning box will pop up for the PDF.</p>
<h2>PDF Layout Tips and Things to Look Out For</h2>
<ol>
<li>Set Report PageSize to 8.5in, 11in for portrait or 11in, 8.5in for landscape.</li>
<li>Set the Report Margins as you would like.</li>
<li>Make sure your Report Body (white staging area in Visual Studio) does not exceed your Report PageSize minus your margins.</li>
<li>Remove any unused white space in Report Body no matter what you set the sizes at.</li>
</ol>
<p class="donate">If this post helped you out, please consider donating to help pay the hosting fees. 100% of the donations go to the web host.</p>

<!-- Begin PayPal Donations by http://wpstorm.net/ -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="jen@jensbits.com" /><input type="hidden" name="return" value="http://www.jensbits.com/thank-you/" /><input type="hidden" name="item_name" value="All donations go to hosting fees for this site." /><input type="hidden" name="currency_code" value="USD" /><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
<!-- End PayPal Donations -->

<p>No related posts.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/jensbits?a=ww7fFivLlRY:Dnj_tRzaWg0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/jensbits?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=ww7fFivLlRY:Dnj_tRzaWg0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/jensbits?i=ww7fFivLlRY:Dnj_tRzaWg0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=ww7fFivLlRY:Dnj_tRzaWg0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/jensbits?i=ww7fFivLlRY:Dnj_tRzaWg0:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/jensbits/~4/ww7fFivLlRY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2012/01/23/generate-sql-server-reporting-services-ssrs-report-as-pdf-from-url-with-vb-net-or-c-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.jensbits.com/2012/01/23/generate-sql-server-reporting-services-ssrs-report-as-pdf-from-url-with-vb-net-or-c-net/</feedburner:origLink></item>
		<item>
		<title>Demos</title>
		<link>http://feedproxy.google.com/~r/jensbits/~3/-GOFlBr_S4Q/</link>
		<comments>http://www.jensbits.com/demolinks/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 18:55:09 +0000</pubDate>
		<dc:creator>jen</dc:creator>
		
		<guid isPermaLink="false">http://www.jensbits.com/?page_id=1420</guid>
		<description><![CDATA[Skip the post. Go straight to the demo. Google Analytics Core Reporting API (Data Export) with Google Chart Visualizations You can punch into the Google Analytics Core Reporting (Data Export) API, pull out some stats, and stuff them into some nice graphical charts using Google Chart Visualizations. Authenticating with OAuth 2.0 for Google API Access [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Skip the post. Go straight to the demo.</p>
<div>
<ul>
<li>
<a href="http://www.jensbits.com/demos/ga/app/">Google Analytics Core Reporting API (Data Export) with Google Chart Visualizations</a></p>
<blockquote><p>You can punch into the Google Analytics Core Reporting (Data Export) API, pull out some stats, and stuff them into some nice graphical charts using Google Chart Visualizations. </p></blockquote>
</li>
<li>
<a href="http://www.jensbits.com/demos/ga/app/oauth2.php">Authenticating with OAuth 2.0 for Google API Access with PHP</a></p>
<blockquote><p>Google is leading developers to OAuth 2.0 for access to its API’s</p></blockquote>
</li>
<li>
<a href="http://www.jensbits.com/demos/ga/app/oauth2refreshtoken.php">Google API Offline Access Using OAuth 2.0 Refresh Token</a></p>
<blockquote><p>Offline access for Google APIs is achieved through a refresh token that is issued when a user first visits the app and grants offline access.</p></blockquote>
</li>
<li><a href="http://www.jensbits.com/demos/autocomplete/">jQuery UI Autocomplete Widget with PHP and MySQL</a><br />
<blockquote><p>The jQuery UI folks have released an autocomplete widget that is pretty slick. This example uses the json_encode function in PHP 5.</p></blockquote>
</li>
<li><a href="http://www.cf-jensbits.com/demos/cf/autocomplete/">jQuery UI Autocomplete Widget with ColdFusion</a><br />
<blockquote><p>Using the jQuery autocomplete widget with ColdFusion is a snap. This example uses the serializeJSON function in ColdFusion 8. </p></blockquote>
<li>
<a href="http://www.jensbits.com/demos/autocomplete_php/zipselect.php">Using jQuery Autocomplete to Populate Another Autocomplete – ASP.NET, ColdFusion, and PHP Examples</a></p>
<blockquote><p>Using one jquery autocomplete to populate another jquery autocomplete on the same page.</p></blockquote>
</li>
<li>
<a href="http://www.jensbits.com/demos/jqsubmit/index.php">jQuery.ajax and jQuery.post Form Submit Examples with PHP</a></p>
<blockquote><p>Two jQuery functions that allow for the submission of form are the jQuery.ajax function and the jQuery.post function.</p></blockquote>
</li>
<li>
<a href="http://www.jensbits.com/demos/forms/index.php">Modal Confirmation Dialog on Form Submit: Javascript, jQuery UI, and Thickbox Varieties</a></p>
<blockquote><p>Modal dialog box that confirms submission of a form.</p></blockquote>
</li>
<li><a href="http://www.jensbits.com/demos/datepicker/index.php">Using jQuery Datepicker and Dialog Box To Select Date Range</a><br />
<blockquote><p>Using a jquery datepicker in a jquery dialog box to select a date range is a handy, slick way of having users input dates. Date handling and validation in forms when input by the user can be tricky at best.</p></blockquote>
</li>
</ul>
</div>
<p>No related posts.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/jensbits?a=-GOFlBr_S4Q:eMbR76ntx-0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/jensbits?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=-GOFlBr_S4Q:eMbR76ntx-0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/jensbits?i=-GOFlBr_S4Q:eMbR76ntx-0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=-GOFlBr_S4Q:eMbR76ntx-0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/jensbits?i=-GOFlBr_S4Q:eMbR76ntx-0:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/jensbits/~4/-GOFlBr_S4Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/demolinks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.jensbits.com/demolinks/</feedburner:origLink></item>
		<item>
		<title>Google API Offline Access Using OAuth 2.0 Refresh Token</title>
		<link>http://feedproxy.google.com/~r/jensbits/~3/SEbGw0_LcSc/</link>
		<comments>http://www.jensbits.com/2012/01/09/google-api-offline-access-using-oauth-2-0-refresh-token/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 19:22:31 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[OAuth]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=1372</guid>
		<description><![CDATA[Offline access for Google APIs is achieved through a refresh token that is issued when a user first visits the app and grants offline access. Essentially, you have to ask for offline access, Google warns them that you are asking for it, and then they have to grant it. The return contains the golden ticket [...]
Related posts:<ol>
<li><a href='http://www.jensbits.com/2011/12/29/google-api-requests-with-oauth-2-0-access-token/' rel='bookmark' title='Google API Requests with OAuth 2.0 Access Token'>Google API Requests with OAuth 2.0 Access Token</a></li>
<li><a href='http://www.jensbits.com/2011/12/20/authenticating-with-oauth-2-0-for-google-api-access-with-php/' rel='bookmark' title='Authenticating with OAuth 2.0 for Google API Access with PHP'>Authenticating with OAuth 2.0 for Google API Access with PHP</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Offline access for Google APIs is achieved through a refresh token that is issued when a user first visits the app and grants offline access. Essentially, you have to ask for offline access, Google warns them that you are asking for it, and then they have to grant it. The return contains the <del datetime="2012-01-19T20:10:17+00:00">golden ticket</del> refresh token.</p>
<blockquote><p>The first time a given user&#8217;s browser is sent to this URL, they see a consent page. If they grant access, then the response includes an authorization code which may be redeemed for an access token and a refresh token.</p></blockquote>
<p>Once a refresh token is obtained, it can be used to access Google APIs that the user has access to without re-authorizing.</p>
<p>See <a href="http://code.google.com/apis/accounts/docs/OAuth2WebServer.html">Google&#8217;s documentation on OAuth 2 for web apps</a> and, for information regarding the refresh token, the <a href="https://developers.google.com/accounts/docs/OAuth2WebServer#offline">Offline Access section</a> for more information.</p>
<h2>Asking for Offline Access</h2>
<h3>Parameters for Login URL</h3>
<p>Client id and client secret are set by Google when the app is registered for api access in the <a href="https://code.google.com/apis/console/#access">Google APIs Console</a>. </p>
<p>The redirect uri is a location on the server that the user is sent to after authenticating. This uri is registered in the Google APIs Console during app registration.</p>
<p>These values can be included as a separate file so the values can easily be swapped out on a per app basis.</p>
<pre class="brush: php; title: ; notranslate">
$client_id = &quot;1111111111111.apps.googleusercontent.com&quot;; //your client id
$client_secret = &quot;xXasdfd212312_dfdf dfxxdf&quot;; //your client secret
$redirect_uri = &quot;http://YOUR-SITE.com/YOUR-PATH/&quot;;
$scope = &quot;https://GOOGLE-SCOPE-TO-ACCESS&quot;; //google scope to access
$state = &quot;profile&quot;; //optional - could be whatever value you want
$access_type = &quot;offline&quot;; //optional - allows for retrieval of refresh_token for offline access
</pre>
<h3>User Login URL</h3>
<p>The login URL will prompt the user for permission to access their Google content via the app and  a &#8220;code&#8221; request variable will be returned in the URL. See <a href="http://code.google.com/apis/accounts/docs/OAuth2Login.html#formingtheurl">Forming the URL</a> for more detailed information.</p>
<pre class="brush: php; title: ; notranslate">
$loginUrl = sprintf(&quot;https://accounts.google.com/o/oauth2/auth?scope=%s&amp;state=%s&amp;redirect_uri=%s&amp;response_type=code&amp;client_id=%s&amp;access_type=%s&quot;, $scope, $state, $redirect_uri, $client_id, $access_type);

&lt;a href=&quot;&lt;?php echo $loginUrl ?&gt;&quot;&gt;Login with Google account using OAuth 2.0&lt;/a&gt;
</pre>
<p>Returned URL example (http://YOUR-SITE.com/YOUR-PATH/ is your redirect uri):</p>
<pre class="brush: xml; title: ; notranslate">

http://YOUR-SITE.com/YOUR-PATH/?state=profile&#038;code=1/fFBGRNJru1FQd44AzqT3Zg
</pre>
<h2>Get Access Token and Refresh Token</h2>
<p>They said &#8220;Yes!&#8221; Initial consent received for offline access and a &#8220;code&#8221; was returned as a request parameter:</p>
<pre class="brush: php; title: ; notranslate">
//Initial grant for access approved by user returns 'code' URL param
if(isset($_REQUEST['code'])){
    $accessToken = get_oauth2_token($_REQUEST['code'],&quot;online&quot;);
}
</pre>
<p>The get_oauth2_token does double duty. It will return an access token for either online or offline access grants.</p>
<p>For the initial grant, if a refresh token is returned, the function puts the refresh token into &#8216;global $refreshToken&#8217;</p>
<p>Why not store the refresh token here instead of putting it in a var? Because there is no reference for the refresh token at this point other than the scope of the grant request. You don&#8217;t know who it belongs to. The initial access token returned with the refresh token can be used to query the API and get data to associate with the refresh token for the database. </p>
<p>If there is a known value (like it belongs to you) to associate with the refresh token that can be used to retrieve it later on, put a call to the database save function in here.</p>
<pre class="brush: php; title: ; notranslate">
//returns session token for calls to API using oauth 2.0
//set global refreshToken var if refresh token is returned
function get_oauth2_token($grantCode,$grantType) {
	global $client_id;
	global $client_secret;
	global $redirect_uri;

	$oauth2token_url = &quot;https://accounts.google.com/o/oauth2/token&quot;;
	$clienttoken_post = array(
	&quot;client_id&quot; =&gt; $client_id,
	&quot;client_secret&quot; =&gt; $client_secret);

	if ($grantType === &quot;online&quot;){
		$clienttoken_post[&quot;code&quot;] = $grantCode;
		$clienttoken_post[&quot;redirect_uri&quot;] = $redirect_uri;
		$clienttoken_post[&quot;grant_type&quot;] = &quot;authorization_code&quot;;
	}

	if ($grantType === &quot;offline&quot;){
		$clienttoken_post[&quot;refresh_token&quot;] = $grantCode;
		$clienttoken_post[&quot;grant_type&quot;] = &quot;refresh_token&quot;;
	}

	$curl = curl_init($oauth2token_url);

	curl_setopt($curl, CURLOPT_POST, true);
	curl_setopt($curl, CURLOPT_POSTFIELDS, $clienttoken_post);
	curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
	curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

	$json_response = curl_exec($curl);
	curl_close($curl);

	$authObj = json_decode($json_response);

	//if offline access requested and granted, get refresh token
	if (isset($authObj-&gt;refresh_token)){
		global $refreshToken;
		$refreshToken = $authObj-&gt;refresh_token;
	}

	$accessToken = $authObj-&gt;access_token;
	return $accessToken;
}
</pre>
<h3>Storing the Refresh Token</h3>
<p>The refresh token will need to be stored for retrieval in the future. This example puts it in a MySQL database.</p>
<p>If a refresh token has been granted, store it in a database. Otherwise, retrieve a refresh token from the database. And, use the refresh token to set an access token for API calls.</p>
<pre class="brush: php; title: ; notranslate">
//get name on account to use as reference in database for retrieving the refresh token
//can be done with data from primary API that is being queried

$googleUserInfoAPI = &quot;https://www.googleapis.com/oauth2/v1/userinfo&quot;;

if (isset($accessToken)){
    //got access token, get data
    $accountObj = call_api($accessToken, $googleUserInfoAPI);
    $account_name =  $accountObj-&gt;name;
}

//refresh token handling - save to db if returned with access token
//or retrieve from db if needed for app
if(isset($refreshToken)){
    $accessToken = dbRefreshToken($account_name,$demo_scope,$refreshToken);
} else {
    $accessTokenFromRefresh = dbRefreshToken('ACCT_NAME_HERE',$demo_scope);
}
</pre>
<p>&#8216;ACCT_NAME_HERE&#8217; is a string that is used to identify for retrieval the refresh token you want to use.</p>
<p>The dbRefreshToken function for saving or retrieving from database and returning an access token:</p>
<pre class="brush: php; title: ; notranslate">
function dbRefreshToken($name,$scope,$refreshToken = &quot;&quot;){
    global $serverpath;
    $path = $serverpath.&quot;/config/token_config.php&quot;;
    include_once($path);
    $path = $serverpath.&quot;/config/db.php&quot;;
    include_once($path);

    if ($conn){
	if (strlen($refreshToken)){
	//if refreshToken in param list, save to db
	    $query = &quot;INSERT INTO tokens (name, scope, token) VALUES (:name, :scope, :refreshToken)&quot;;
	    $result = $conn-&gt;prepare($query);
	    $result-&gt;bindValue(':name', $name, PDO::PARAM_STR);
	    $result-&gt;bindValue(':scope', $scope, PDO::PARAM_STR);
	    $result-&gt;bindValue(':refreshToken', $refreshToken, PDO::PARAM_STR);
	    $result-&gt;execute();
	    $token = $refreshToken;
       } else {
        //else retrieve refresh token from db
	    $query = &quot;SELECT token from tokens where name = :name and scope = :scope&quot;;
	    $result = $conn-&gt;prepare($query);
	    $result-&gt;bindValue(':name',$name, PDO::PARAM_STR);
	    $result-&gt;bindValue(':scope', $scope, PDO::PARAM_STR);
	    $result-&gt;execute();
	    $row = $result-&gt;fetch(PDO::FETCH_ASSOC);
	    $token = $row[&quot;token&quot;];
        }

    mysql_close($conn);

    $accessTokenfromRefresh = get_oauth2_token($token,&quot;offline&quot;);
    return $accessTokenfromRefresh;
   }
}
</pre>
<p>Note that config.php contains your database configuration parameter (username, password, database name) and db.php contains the actual connection string. Put them in a folder and restrict web browsing to that folder.</p>
<p>The table is called &#8216;tokens&#8217; and the columns are name, scope, and token.</p>
<p id="demo"><a href="/demos/ga/app/oauth2refreshtoken.php"><span>Demo</span></a></p>
<p id="download"><a href="/demos/ga/app/ga_app_oauth2_refreshtoken.txt"><span>Download code</span></a></p>
<p class="donate">If this post helped you out, please consider donating to help pay the hosting fees. 100% of the donations go to the web host.</p>

<!-- Begin PayPal Donations by http://wpstorm.net/ -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="jen@jensbits.com" /><input type="hidden" name="return" value="http://www.jensbits.com/thank-you/" /><input type="hidden" name="item_name" value="All donations go to hosting fees for this site." /><input type="hidden" name="currency_code" value="USD" /><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
<!-- End PayPal Donations -->

<p>Related posts:<ol>
<li><a href='http://www.jensbits.com/2011/12/29/google-api-requests-with-oauth-2-0-access-token/' rel='bookmark' title='Google API Requests with OAuth 2.0 Access Token'>Google API Requests with OAuth 2.0 Access Token</a></li>
<li><a href='http://www.jensbits.com/2011/12/20/authenticating-with-oauth-2-0-for-google-api-access-with-php/' rel='bookmark' title='Authenticating with OAuth 2.0 for Google API Access with PHP'>Authenticating with OAuth 2.0 for Google API Access with PHP</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/jensbits?a=SEbGw0_LcSc:bArxkpHTHxY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/jensbits?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=SEbGw0_LcSc:bArxkpHTHxY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/jensbits?i=SEbGw0_LcSc:bArxkpHTHxY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=SEbGw0_LcSc:bArxkpHTHxY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/jensbits?i=SEbGw0_LcSc:bArxkpHTHxY:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/jensbits/~4/SEbGw0_LcSc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2012/01/09/google-api-offline-access-using-oauth-2-0-refresh-token/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.jensbits.com/2012/01/09/google-api-offline-access-using-oauth-2-0-refresh-token/</feedburner:origLink></item>
		<item>
		<title>Google API Requests with OAuth 2.0 Access Token</title>
		<link>http://feedproxy.google.com/~r/jensbits/~3/IJtneQA4P_A/</link>
		<comments>http://www.jensbits.com/2011/12/29/google-api-requests-with-oauth-2-0-access-token/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 19:42:00 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[OAuth]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=1351</guid>
		<description><![CDATA[In the Authenticating with OAuth 2.0 for Google API Access with PHP post, an access token was retrieved for calls to Google APIs for data. In this post, the user&#8217;s name will be retrieved from their account. To do that, the access token needs to be sent as a header param or query param with [...]
Related posts:<ol>
<li><a href='http://www.jensbits.com/2012/01/09/google-api-offline-access-using-oauth-2-0-refresh-token/' rel='bookmark' title='Google API Offline Access Using OAuth 2.0 Refresh Token'>Google API Offline Access Using OAuth 2.0 Refresh Token</a></li>
<li><a href='http://www.jensbits.com/2011/12/20/authenticating-with-oauth-2-0-for-google-api-access-with-php/' rel='bookmark' title='Authenticating with OAuth 2.0 for Google API Access with PHP'>Authenticating with OAuth 2.0 for Google API Access with PHP</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.jensbits.com/2011/12/20/authenticating-with-oauth-2-0-for-google-api-access-with-php/">Authenticating with OAuth 2.0 for Google API Access with PHP</a> post, an access token was retrieved for calls to Google APIs for data. In this post, the user&#8217;s name will be retrieved from their account.</p>
<p>To do that, the access token needs to be sent as a header param or query param with the call to the userinfo Google API. See <a href="http://code.google.com/apis/accounts/docs/OAuth2WebServer.html#callinganapi">Calling a Google API</a> for more information. The header param method is shown below.</p>
<p>A PHP object containing the account info will be returned by a call to &#8220;call_api&#8221; function with the access token and API URL passed in:</p>
<pre class="brush: php; title: ; notranslate">
$accountObj = call_api($_SESSION['accessToken'],&quot;https://www.googleapis.com/oauth2/v1/userinfo&quot;);
</pre>
<p>&#8220;call_api&#8221; calls the api and gets the data:</p>
<pre class="brush: php; title: ; notranslate">
function call_api($accessToken,$url){
	$curl = curl_init($url);

	curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
	curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	$curlheader[0] = &quot;Authorization: Bearer &quot; . $accessToken;
	curl_setopt($curl, CURLOPT_HTTPHEADER, $curlheader);

	$json_response = curl_exec($curl);
	curl_close($curl);

	$responseObj = json_decode($json_response);

	return $responseObj;
}
</pre>
<p>From the account object, the name can be accessed;</p>
<pre class="brush: php; title: ; notranslate">
$your_name =  $accountObj-&gt;name;

echo &quot;&lt;p class='successMessage'&gt;The name on your Google account is: &quot; . $your_name . &quot;&lt;/p&gt;&quot;;
</pre>
<p id="demo"><a href="/demos/ga/app/oauth2api.php"><span>Demo</span></a></p>
<p id="download"><a href="/demos/ga/app/ga_app_oauth2.txt"><span>Download code</span></a></p>
<p class="donate">If this post helped you out, please consider donating to help pay the hosting fees. 100% of the donations go to the web host.</p>

<!-- Begin PayPal Donations by http://wpstorm.net/ -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="jen@jensbits.com" /><input type="hidden" name="return" value="http://www.jensbits.com/thank-you/" /><input type="hidden" name="item_name" value="All donations go to hosting fees for this site." /><input type="hidden" name="currency_code" value="USD" /><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
<!-- End PayPal Donations -->

<p>Related posts:<ol>
<li><a href='http://www.jensbits.com/2012/01/09/google-api-offline-access-using-oauth-2-0-refresh-token/' rel='bookmark' title='Google API Offline Access Using OAuth 2.0 Refresh Token'>Google API Offline Access Using OAuth 2.0 Refresh Token</a></li>
<li><a href='http://www.jensbits.com/2011/12/20/authenticating-with-oauth-2-0-for-google-api-access-with-php/' rel='bookmark' title='Authenticating with OAuth 2.0 for Google API Access with PHP'>Authenticating with OAuth 2.0 for Google API Access with PHP</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/jensbits?a=IJtneQA4P_A:zAcdd9nh6xc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/jensbits?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=IJtneQA4P_A:zAcdd9nh6xc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/jensbits?i=IJtneQA4P_A:zAcdd9nh6xc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=IJtneQA4P_A:zAcdd9nh6xc:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/jensbits?i=IJtneQA4P_A:zAcdd9nh6xc:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/jensbits/~4/IJtneQA4P_A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2011/12/29/google-api-requests-with-oauth-2-0-access-token/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.jensbits.com/2011/12/29/google-api-requests-with-oauth-2-0-access-token/</feedburner:origLink></item>
		<item>
		<title>Authenticating with OAuth 2.0 for Google API Access with PHP</title>
		<link>http://feedproxy.google.com/~r/jensbits/~3/hd4aMW0jyW8/</link>
		<comments>http://www.jensbits.com/2011/12/20/authenticating-with-oauth-2-0-for-google-api-access-with-php/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 00:21:22 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[OAuth]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=1327</guid>
		<description><![CDATA[Google is leading developers to OAuth 2.0 for access to its API&#8217;s: Given the security implications of getting the implementation correct, we strongly encourage developers to use OAuth 2.0 libraries when interacting with Google&#8217;s OAuth 2.0 endpoints (see Client libraries for more information). Over time, more features will be added to these libraries. Steps Register [...]
Related posts:<ol>
<li><a href='http://www.jensbits.com/2011/12/29/google-api-requests-with-oauth-2-0-access-token/' rel='bookmark' title='Google API Requests with OAuth 2.0 Access Token'>Google API Requests with OAuth 2.0 Access Token</a></li>
<li><a href='http://www.jensbits.com/2012/01/09/google-api-offline-access-using-oauth-2-0-refresh-token/' rel='bookmark' title='Google API Offline Access Using OAuth 2.0 Refresh Token'>Google API Offline Access Using OAuth 2.0 Refresh Token</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Google is leading developers to OAuth 2.0 for access to its API&#8217;s:</p>
<blockquote><p>Given the security implications of getting the implementation correct, we strongly encourage developers to use OAuth 2.0 libraries when interacting with Google&#8217;s OAuth 2.0 endpoints (see Client libraries for more information). Over time, more features will be added to these libraries.</p></blockquote>
<h2>Steps</h2>
<ol>
<li><a href="https://code.google.com/apis/console/#access">Register the app with Google</a></li>
<li>Create login URL and retrieve &#8220;code&#8221;</li>
<li>Exchange &#8220;code&#8221; for access token</li>
<li>Send access token with API requests (<a href="http://www.jensbits.com/2011/12/29/google-api-requests-with-oauth-2-0-access-token/">details in this post</a>)</li>
</ol>
<p>Google details the instructions in <a href="http://code.google.com/apis/accounts/docs/OAuth2.html">Using OAuth 2.0 to Access Google APIs</a>.  </p>
<p>Steps for registering your app can be found in <a href="http://code.google.com/p/google-api-php-client/wiki/OAuth2">APIs Client Library for PHP</a>. </p>
<p>Google scope values for its API&#8217;s can be found in the <a href="https://code.google.com/oauthplayground/">OAuth 2.0 Playground</a>.</p>
<h2>Create Login URL and Retrieve &#8220;Code&#8221;</h2>
<h3>Parameters for Login URL</h3>
<p>Client id and client secret are set by Google when the app is registered for api access in the <a href="https://code.google.com/apis/console/#access">Google APIs Console</a>. </p>
<p>The redirect uri is a location on the server that the user is sent to after authenticating. This uri is registered in the Google APIs Console during app registration.</p>
<p>These values can be included as a separate file so the values can easily be swapped out on a per app basis.</p>
<pre class="brush: php; title: ; notranslate">
$client_id = &quot;1111111111111.apps.googleusercontent.com&quot;; //your client id
$client_secret = &quot;XxxXXxxXXxXXxXxXXXxXXXX&quot;; //your client secret
$redirect_uri = &quot;http://YOUR-SITE.com/YOUR-PATH/&quot;;
$scope = &quot;https://GOOGLE-SCOPE-TO-ACCESS&quot;; //google scope to access
$state = &quot;profile&quot;; //optional
$access_type = &quot;offline&quot;; //optional - allows for retrieval of refresh_token for offline access
</pre>
<h3>User Login URL</h3>
<p>The login URL will prompt the user for permission to access their Google content via the app and  a &#8220;code&#8221; request variable will be returned in the URL. See <a href="http://code.google.com/apis/accounts/docs/OAuth2Login.html#formingtheurl">Forming the URL</a> for more detailed information.</p>
<pre class="brush: php; title: ; notranslate">
$loginUrl = sprintf(&quot;https://accounts.google.com/o/oauth2/auth?scope=%s&amp;state=%s&amp;redirect_uri=%s&amp;response_type=code&amp;client_id=%s&amp;access_type=%s&quot;, $scope, $state, $redirect_uri, $client_id, $access_type);

&lt;a href=&quot;&lt;?php echo $loginUrl ?&gt;&quot;&gt;Login with Google account using OAuth 2.0&lt;/a&gt;
</pre>
<p>Returned URL example (http://YOUR-SITE.com/YOUR-PATH/ is your redirect uri):</p>
<pre class="brush: xml; title: ; notranslate">

http://YOUR-SITE.com/YOUR-PATH/?state=profile&#038;code=1/fFBGRNJru1FQd44AzqT3Zg
</pre>
<h2>Exchange &#8220;Code&#8221; for Access Token</h2>
<p>If access type was set to &#8220;offline&#8221; in the login URL, a refresh token will be sent with the access token so the data can be accessed without prompting the user again.</p>
<pre class="brush: php; title: ; notranslate">
//Oauth 2.0: exchange token for session token so multiple calls can be made to api
if(isset($_REQUEST['code'])){
	$_SESSION['accessToken'] = get_oauth2_token($_REQUEST['code']);
}

//returns session token for calls to API using oauth 2.0
function get_oauth2_token($code) {
	global $client_id;
	global $client_secret;
	global $redirect_uri;

	$oauth2token_url = &quot;https://accounts.google.com/o/oauth2/token&quot;;
	$clienttoken_post = array(
	&quot;code&quot; =&gt; $code,
	&quot;client_id&quot; =&gt; $client_id,
	&quot;client_secret&quot; =&gt; $client_secret,
	&quot;redirect_uri&quot; =&gt; $redirect_uri,
	&quot;grant_type&quot; =&gt; &quot;authorization_code&quot;
	);

	$curl = curl_init($oauth2token_url);

	curl_setopt($curl, CURLOPT_POST, true);
	curl_setopt($curl, CURLOPT_POSTFIELDS, $clienttoken_post);
	curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
	curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

	$json_response = curl_exec($curl);
	curl_close($curl);

	$authObj = json_decode($json_response);

	if (isset($authObj-&gt;refresh_token)){
        //refresh token only granted on first authorization for offline access
        //save to db for future use (db saving not included in example)
		global $refreshToken;
		$refreshToken = $authObj-&gt;refresh_token;
	}

	$accessToken = $authObj-&gt;access_token;
	return $accessToken;
}
</pre>
<p>You now have an access token to present to the Google API of your choice (specified in the scope) for data.</p>
<p id="demo"><a href="/demos/ga/app/oauth2.php"><span>Demo</span></a></p>
<p id="download"><a href="/demos/ga/app/ga_app_oauth2.txt"><span>Download code</span></a></p>
<p class="donate">If this post helped you out, please consider donating to help pay the hosting fees. 100% of the donations go to the web host.</p>

<!-- Begin PayPal Donations by http://wpstorm.net/ -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="jen@jensbits.com" /><input type="hidden" name="return" value="http://www.jensbits.com/thank-you/" /><input type="hidden" name="item_name" value="All donations go to hosting fees for this site." /><input type="hidden" name="currency_code" value="USD" /><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
<!-- End PayPal Donations -->

<p>Related posts:<ol>
<li><a href='http://www.jensbits.com/2011/12/29/google-api-requests-with-oauth-2-0-access-token/' rel='bookmark' title='Google API Requests with OAuth 2.0 Access Token'>Google API Requests with OAuth 2.0 Access Token</a></li>
<li><a href='http://www.jensbits.com/2012/01/09/google-api-offline-access-using-oauth-2-0-refresh-token/' rel='bookmark' title='Google API Offline Access Using OAuth 2.0 Refresh Token'>Google API Offline Access Using OAuth 2.0 Refresh Token</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/jensbits?a=hd4aMW0jyW8:Mx8HMABZQxc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/jensbits?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=hd4aMW0jyW8:Mx8HMABZQxc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/jensbits?i=hd4aMW0jyW8:Mx8HMABZQxc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=hd4aMW0jyW8:Mx8HMABZQxc:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/jensbits?i=hd4aMW0jyW8:Mx8HMABZQxc:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/jensbits/~4/hd4aMW0jyW8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2011/12/20/authenticating-with-oauth-2-0-for-google-api-access-with-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.jensbits.com/2011/12/20/authenticating-with-oauth-2-0-for-google-api-access-with-php/</feedburner:origLink></item>
		<item>
		<title>Jquery Datepicker with Masked Input and Current Time</title>
		<link>http://feedproxy.google.com/~r/jensbits/~3/nxIa9STqZfc/</link>
		<comments>http://www.jensbits.com/2011/09/22/jquery-datepicker-with-masked-input-and-current-time/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 18:43:49 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[jquery datepicker]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=1283</guid>
		<description><![CDATA[Examples of using a jquery ui datepicker with masked input and current time as input values. Input is editable for manual change of date and/or time. Help in this post can from Adding time to jQuery UI Datepicker by Derek Allard and the Masked Input Plugin 1.3 by Josh Bush. There are two functions: getTimeAmPm [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p>Examples of using a jquery ui datepicker with masked input and current time as input values. Input is editable for manual change of date and/or time.</p>
<p>Help in this post can from <a href="http://www.derekallard.com/blog/post/adding-time-to-jquery-ui-datepicker">Adding time to jQuery UI Datepicker by Derek Allard</a> and the <a href="http://digitalbush.com/2011/03/27/masked-input-plugin-1-3/">Masked Input Plugin 1.3 by Josh Bush</a>.</p>
<p>There are two functions: </p>
<ol>
<li>getTimeAmPm &#8211; formats time for standard AM/PM display</li>
<li>getTime24 &#8211; format time for 24-hour display (sometimes called military time)</li>
</ol>
<pre class="brush: jscript; title: ; notranslate">
function getTimeAmPm() {

    var date_o = new Date();

    var date_mins = date_o.getMinutes() &lt; 10 ? &quot;0&quot; + date_o.getMinutes() : date_o.getMinutes();

    var date_hours = date_o.getHours() &gt; 12 ? &quot;0&quot; + (date_o.getHours() - 12) : date_o.getHours();

    var date_am_pm = date_o.getHours() &lt; 12 ?  &quot; AM&quot; : &quot; PM&quot;;

    // handle midnight
    date_hours = date_hours === 0 ? 12 : date_hours;

    return &quot;'&quot; + date_hours + &quot;:&quot; + date_mins + &quot; &quot; + date_am_pm + &quot;'&quot;;
}

function getTime24() {

    var date_o = new Date();

    var date_hours = date_o.getHours() &lt; 10 ? &quot;0&quot; + date_o.getHours() : date_o.getHours();

    var date_mins = date_o.getMinutes() &lt; 10 ? &quot;0&quot; + date_o.getMinutes() : date_o.getMinutes();

    return &quot;'&quot; + date_hours + &quot;:&quot; + date_mins + &quot;'&quot;;
}
</pre>
<p>The datepickers concatenate on the result from one of the time format functions and they both have the mask jquery plugin function by Josh applied to them:</p>
<pre class="brush: jscript; title: ; notranslate">
$(&quot;.datepicker&quot;).datepicker({dateFormat: 'yy-mm-dd ' + getTimeAmPm()});

$(&quot;.datepicker&quot;).mask(&quot;9999-99-99 99:99 aa&quot;);

$(&quot;.datepicker24&quot;).datepicker({dateFormat: 'yy-mm-dd ' + getTime24()});

$(&quot;.datepicker24&quot;).mask(&quot;9999-99-99 99:99&quot;);
</pre>
<p>The HTML just has a couple of inputs for the examples:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;input class=&quot;datepicker&quot; type=&quot;text&quot; /&gt; AM / PM
&lt;br /&gt;
&lt;input class=&quot;datepicker24&quot; type=&quot;text&quot; /&gt; 24 hour
</pre>
<h2>Recommended</h2>
<div style="height:250px;">
<div style="float:left;margin-right: 25px">
<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=jensbits-20&#038;o=1&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=047097723X" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</div>
<div style="float:left;margin-right: 25px">
<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=jensbits-20&#038;o=1&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=1849516545" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</div>
<div style="float:left;margin-right: 25px">
<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=jensbits-20&#038;o=1&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=ss_til&#038;asins=1430237953" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</div>
<div style="float:left;margin-right: 25px">
<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=jensbits-20&#038;o=1&#038;p=8&#038;l=as1&#038;m=amazon&#038;f=ifr&#038;md=10FE9736YVPPT7A0FBG2&#038;asins=0321509021" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
</div>
</div>
<h2>Demo</h2>
<p><iframe style="width: 100%; height: 150px" src="http://jsfiddle.net/jensbits/3yUes/embedded/result,js,html/"></iframe></p>
<p class="donate">If this post helped you out, please consider donating to help pay the hosting fees. 100% of the donations go to the web host.</p>

<!-- Begin PayPal Donations by http://wpstorm.net/ -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><div class="paypal-donations"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="jen@jensbits.com" /><input type="hidden" name="return" value="http://www.jensbits.com/thank-you/" /><input type="hidden" name="item_name" value="All donations go to hosting fees for this site." /><input type="hidden" name="currency_code" value="USD" /><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online." /><img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /></div></form>
<!-- End PayPal Donations -->

<p>No related posts.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/jensbits?a=nxIa9STqZfc:WcY7FQekbwU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/jensbits?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=nxIa9STqZfc:WcY7FQekbwU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/jensbits?i=nxIa9STqZfc:WcY7FQekbwU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=nxIa9STqZfc:WcY7FQekbwU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/jensbits?i=nxIa9STqZfc:WcY7FQekbwU:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/jensbits/~4/nxIa9STqZfc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2011/09/22/jquery-datepicker-with-masked-input-and-current-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.jensbits.com/2011/09/22/jquery-datepicker-with-masked-input-and-current-time/</feedburner:origLink></item>
		<item>
		<title>Breaking Development 2011 Nashville – Mobile Goodness</title>
		<link>http://feedproxy.google.com/~r/jensbits/~3/CNSMnv9sTvA/</link>
		<comments>http://www.jensbits.com/2011/09/21/breaking-development-2011-nashville-mobile-goodness/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 15:15:58 +0000</pubDate>
		<dc:creator>jen</dc:creator>
				<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.jensbits.com/?p=1273</guid>
		<description><![CDATA[On September 12th, 2011 the Breaking Development conference rolled into Nashville. With two full days of talks and one full day of workshops, this single-track, superbly organized event did not disappoint. Previously in Dallas, Breaking Development: Nashville focused on new, emerging techniques for web development and design for mobile devices. Topics of the talks included [...]
No related posts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://lanyrd.com/2012/bdconf-orlando/"><img src="http://www.jensbits.com/wp-content/uploads/2011/09/bdconf.gif" alt="breaking development logo" title="bdconf" width="250" height="72" class="alignright size-full wp-image-1274" /></a>On September 12th, 2011 the Breaking Development conference rolled into Nashville. With two full days of talks and one full day of workshops, this single-track, superbly organized event did not disappoint. Previously in Dallas, Breaking Development: Nashville focused on new, emerging techniques for web development and design for mobile devices. Topics of the talks included responsive design, resource and page optimization, designing mobile web experiences, designing for touch, building mobile apps with web technology, and native mobile apps versus mobile web apps.</p>
<p>This was simply the best conference I have attended. Every session had real-world, immediately applicable techniques and ideas.</p>
<p>Some of the featured concepts included:</p>
<ul>
<li>Mobile is minefield. Ground is still shifting.</li>
<li>Mobile apps are good at certain type of activity but porting to multiple devices is painful.</li>
<li>Visual design on mobile is about usability not pixel perfection.</li>
<li>People are accessing your content on phone web browser whether you want them to or not so make it good because clients want positive experience with brand.</li>
<li>Every unoptimized mobile link perpetuates negative perception.</li>
<li>80% of mobile web users would access web content more often if experience was good.</li>
<li> 80% of branded apps achieve less than 1,000 downloads and whether or not users keep app on phone is up to them.</li>
<li>Create best experience for most devices. And superior support for top devices to site.</li>
<li>Mobile is the most important technology since the printing press.</li>
</ul>
<p><a href="http://lanyrd.com/2011/bdconf/">View the presentation slides and session descriptions.</a></p>
<p>Next <a href="http://2012.bdconf.com/">Breaking Development conference is in Orlando</a>. Worth your time and money. Updates for Orlando can be found on <a href="http://lanyrd.com/2012/bdconf-orlando/">Lanyrd</a>.</p>
<p>No related posts.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/jensbits?a=CNSMnv9sTvA:1WWFsQqjLnA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/jensbits?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=CNSMnv9sTvA:1WWFsQqjLnA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/jensbits?i=CNSMnv9sTvA:1WWFsQqjLnA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/jensbits?a=CNSMnv9sTvA:1WWFsQqjLnA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/jensbits?i=CNSMnv9sTvA:1WWFsQqjLnA:F7zBnMyn0Lo" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/jensbits/~4/CNSMnv9sTvA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.jensbits.com/2011/09/21/breaking-development-2011-nashville-mobile-goodness/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.jensbits.com/2011/09/21/breaking-development-2011-nashville-mobile-goodness/</feedburner:origLink></item>
	</channel>
</rss>

