博文

目前显示的是 四月, 2013的博文

Google Analytics的account结构

图片
Nothing is better than a picture: Account: Top-most level of organization Property:  Website, mobile app, blog, etc Property is the level of tracking code ID. Property has one un-filtered profile Profile: Access point for report A defined view of data from a property Once profile get deleted, the data of this profiel get lost forever. Users: User or administrator

理解 Google Analytics中的 Bounce Rate 和 Exit Rate

Bounce Rate: Bounce rate is the percentage of visits that go only one page before exiting a site. Bounce rate calculation is only based on visits that start with that page.  Ex: There are 3 visits: 1. Page A->B->C->Exit 2. Page B->A->C->Exit 3. Page A->Exit The bounce rate for A is 50% (Not 33%, because visit No.2 does not involve in page A's bounce rate calculation) Exit rate is the percentage of visits that exit from the particular page. Follow above example: The exit rate for A is 33% (A involve in 3 sessions, and only 1 session end from A) The exit rate for B is 0% (B involve in 2 sessions, and no session end from B)

Google analytics event tracking (web tracking)

is a method in ga.js record user-interaction with web element attach method call to paticular UI element pageview calculation unaffected Setup: _trackEvent(category, action, opt_label, opt_value, opt_noninteraction) Ex: _gaq.push('_trackEvent','Videos','Download','Gone with wind'); Category: required, appear in event report the group name of the objects we want to track Actions: In report actions are listed independently from parent category Unique event is affected by unique action name unique event per category-action pair difference in "top action" and "category action" report Labels: not required can provide additional dimension in report Values: not required, integer value, NOT negtive value Non-interaction events: If set this attribute to True, means this user-interaction does not counted as an interaction on this page. So if the visit ends from this page, the page is considered "boun...

Enable deep stub(chaining methods) with Mockito

Mockito 是一个使用简单的unit test library: It enables mocks creation, verification and stubbing. 有时候在使用Mockito来mock一个类,并且stub其方法时,若是使用: Foo mock = mock(Foo.class); when(mock.getBar().getName()).thenReturn("NullPointerException"); 我们将会得到NullPointerException,这是因为mock.getBar()将会返回null值。 这时候我们可以使用: Foo mock = mock(Foo.class, RETURNS_DEEP_STUBS); // note that we're stubbing a chain of methods here: getBar().getName() when(mock.getBar().getName()).thenReturn("deep");  // note that we're chaining method calls: getBar().getName() assertEquals("deep",mock.getBar().getName()); 注意应该尽量少的使用这种deep stub,这种方法应该只用在测试legancy code中。 更多资料参考: http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html#3 http://mockito.googlecode.com/svn/tags/1.8.3/javadoc/org/mockito/Mockito.html#RETURNS_DEEP_STUBS

What I did to reproduce the consequence of misuse of git merge commit

图片
Git is a powerful tool. More power means more responsibility.  We use git in our project. There are several developers so the commits are quite frequent.  Symptom:  Sometimes we see our changes and corresponding commits disappears after some developer do their merge commit. Their merge commit seems to have reverted away commits which has been done earlier by others.  In the commit log we see the guilty merge commit behavior very strange: It has two parent A and B. A is the guilty developer's local commit branch, and B is the other developer's commits branch. Strangely the merged commit would choose the status of A instead B in the merged results for files that has been changed and committed in commit branch B(which is other developers' commit). So the consequence is that after the merge commit, the changes has been committed and pushed by other developer will "gone"! The status of the   files from other developers' commit are "...

Google analytics custom campaigns tracking

无法查看这则摘要。请 点击此处查看博文。

Git error "Could not write new index file"

1. 检查看是不是disk space用光了 2. 如果问题出在index file上 $ rm -f .git/index $ git reset 3. 如果问题出在packfile上 $ git index-pack

渔歌 byssan lull (中文翻译)

http://youtu.be/bAAUX5qZfOw Byssan lull, koka kittelen full, Där kommer tre vandringsmän på vägen Den ene, ack så halt, Den andre, o så blind, Den tredje säger alls ingenting 大锅在渔船的厨房里安静的烧开着。 三个流浪者来到这里。 第一个说,啊,这么滑。 第二个说,啊,这么暗。 第三个人却是默默无言。 Byssan lull, koka kittelen full, På himmelen vandra tre stjärnor Den ena är så vit, Den andra är så röd, Den tredje är månen den gula 大锅在渔船的厨房里安静的烧开着。 天空中点缀着三颗星星。 一个如此洁白。 一个红的耀眼。 一个是月亮般的金色。 Byssan lull, koka kittelen full, Där blåser tre vindar på haven, På Stora ocean, På lilla Skagerack Och långt upp I Bottniska viken 大锅在渔船的厨房里安静的烧开着。 海面上吹来了一阵阵微风。 从大洋上吹来。从斯卡格拉克海峡吹来。 从遥远的波的尼亚海湾吹来。 Byssan lull, koka kittelen full, Där segla tre skutor på vågen Den första är en bark, Den andra är en brigg, Den tredje har så trasiga segel 大锅在渔船的厨房里安静的烧开着。 三只小船漂了过来。 第一个是三桅帆船。 第二个是双桅船。 另一个有着破旧的帆。 Byssan lull, koka kittelen full, Sjökistan har trenne figurer Den första är vår tro, Den andra är vårt hopp, Den tredje är kär...

Google analytics custom variables 笔记

Custom variable: Is a name-value pair Custom variables can help to define additional segments There are 3 levels in GA's visitor interaction model visitor session page _setCustomVar(index, name, value, opt_scope) index - slot 1 to 5, required opt_scope - 1,2,3 default to page scope 3 You can _deleteCustomVar(index) to remove a CV Call _setCustomVar() before pageView or event Page level: A single pageView, event, or transaction call Variable slots can be reused on one page, but only the last one will apply in that case For any single page, only up to 5 CV can be used Session level: Apply to the current session - decided by cookies Last set value in the session scope CV win If use the same slot, session scoped CV will override page scoped CV(see note 1) For any given session, up to 5 CV can be used Visitor level: Current and future session for the lift of visitor cookies Last set value in the last session win Up to 5 Note 1: When use...

Google analytics advanced segments + Dimension and metrics

Advanced segments: Isolate and analyze specific kind of traffic Different with filtered profile Historical data can use segment Can compare or view multiple segments Filters is better if you always want to have a filtered traffic Segments can apply to filtered profile data Filtered profile data can work with user's view permission, on the other hand, permission can not control advanced segment Dimension and metrics: Dimension for describe data while metrics for measure data There are certain combinations of dimensions and metrics for custom report

Git - Solution to huge git object folder

如果你的disk space 不够大,而你又有一个巨大的object folder 在 .git 文件夹下你可以使用以下办法: A. 1. git fsck list all unreachable blobs 2. git prune delete unreachable blobs 或者 B. 1. git reflog expire --expire=now 2. git repack -ad remove dangling files from pack files 3. git prune 或者 C. git gc --aggressive --prune 或者 D. 删除 一些old and huge files in object/pack 文件夹...

Google analytics E-commerce tracking

Enable E-commerce on profile include or not include cross-domain tracking Add eCommerce tracking on web transaction object - _addTrans() transaction item - _addItem() submit transaction - _trackTrans() Guidelines Unique SKU for each item added Price is without currency, should convert in own code before submit to analytics Recommended to call _trackPageView on order confirmation page You can set local currency  Issues You can reverse an transaction by using negative value eCommerce tracking allow segments and custom segments Those are not the same as filters They apply the on final data

Google analytics tracking code

Install tracking code: Use new asynchronous code Wait 24h for setting to take effect Recommended to put script at bottom of HTML HEAD Specialized tracking: Download links _trackPageView() -virtual page view _trackEvent() Outbounds links _trackEvent() +  depay outbound link by JS Redirections Flash  virtual page view - possibility to get visits inflating track event Tracking across domains: Add links Multiple tracking code on one page is not supported Search engine robot normally not active JS, so their visits are not tracked Conversion triggered when goals reached: Goals URL destination goal + funnels(steps to follow in goals) time on site page per visit Combine goals and funnels URL destination goal: Fixed URL E-commerce - leave goal value blank, since they are tracked by code URL parameter - head match or regEx Same URL for different steps - use track code to create virtual page view

在ant中使用if..else

有时候我们需要在ant的target中使用一些if...else的逻辑判断,ant给我们提供了两种使用方法: 1.  使用 <if><available file="${path}/classes" type="dir" /> <then> <echo level="info" message="do sth if dir exist" /> </then> <else> <echo level="info" message="do sth if dir does not exist" /> </else> </if> 使用这种if...else 时要确保ant-contrib.jar 在你的 ANT_HOME\lib directory中。 2. 使用ant condition and available <project name="test" default="doFoo" basedir=".">    <property name="directory" value="c:testdirectory"/>    <target name="doFoo" depends="dir.check" if="dir.exists">     <echo>${directory} exists</echo>    </target>    <target name="doBar" depends="dir.check" unless="dir.exists">     <echo>${directory} missing"</echo>    </target...