博文

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