Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sendHostname can works after 7 days and change GA Tracking ID #20

Merged
merged 8 commits into from
Dec 5, 2018

Conversation

sohee-lee7
Copy link
Contributor

GA 관련하여 sendHostname 함수 변경사항입니다.

  • localstorage 사용 : 기록 시점의 시간을 저장하여 7일 후에 다시 갱신하도록 하였습니다.
  • trackingID 분리 : 어플리케이션 5개 및 기타 컴포넌트들은 1개의 ID로 GA를 호출하도록 하였습니다.

@seonim-ryu
Copy link
Member

Can one of the admins verify this patch?

@sohee-lee7 sohee-lee7 changed the title Feat/ga/once feat: sendHostname can works after 7 days and change GA Tracking ID Dec 4, 2018
*/
function isExpired(date) {
var now = new Date().getTime();
var ms7days = 7 * 24 * 60 * 60 * 1000;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract ms7days variable to calculate this once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix it.

var trackingId = 'UA-115377265-9';
var eventCategory = 'use';
var trackingId = trackingIdMap[applicationId] || trackingIdMap.component;
var applicationKeyForStorage = 'TOAST UI ' + applicationId + ' for ' + hostname + ': Statistics';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The application name's first letter should be upper case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All components call 'sendHostname' with name of lower case.


// skip only if the flag is defined and is set to false explicitly
// skip if the flag is defined and is set to false explicitly
if (!type.isUndefined(window.tui) && window.tui.usageStatistics === false) {
Copy link

@dongsik-yoo dongsik-yoo Dec 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the first condition be true? This namespace tui always exist after loading tui-code-snippet.js, doesn't it?

@dongsik-yoo
Copy link

[12/04] Reviewed. Good job 👍

Copy link
Member

@shiren shiren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

각 프로젝트의 ga관련 리드미 파트에 웹스토리지에 데이터를 사용한다는 정보를 추가해야합니다.

'chart': 'UA-129983528-1',
'image-editor': 'UA-129999381-1',
'component': 'UA-129987462-1'
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아이디는 여기서들고 있는것이 아니라 사용하는 쪽에서 들고 있어야 할것 같아요.
새 프로젝트가 추가되거나 ga 트래킹을 안 하던 프로젝트가 추가되게 되면 불필요하게 codesnippet도 배포해야 하니까요..
웹스토리지 키를 만드는것 때문에 필요하다면 이름도 추가하면 될것 같아요.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이름과 아이디를 받는 형식으로 수정하겠습니다.

var trackingId = 'UA-115377265-9';
var eventCategory = 'use';
var trackingId = trackingIdMap[applicationId] || trackingIdMap.component;
var applicationKeyForStorage = 'TOAST UI ' + applicationId + ' for ' + hostname + ': Statistics';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어플리케이션 별로 웹스토리지를 데이터를 만들 필요가 과연 있을까 싶어요..
2개 이상의 TOAST UI 제품을 사용한다면 모든 ga 수집에 동의하지 않을것 같아요.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

한 호스트에서 2개 이상의 TOAST UI 제품을 사용하고 로컬스토리지 1개로 판별하게 되면, 제품 중 하나만 GA를 보내게 되어 나머지는 기록에 누락될 수 있을 것 같습니다. 그래서 제품별로 로컬스토리지는 따로 갖고 있어야 할 것 같습니다.

// skip if the flag is defined and is set to false explicitly
if (tui.usageStatistics === false) {
return;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if using the global tui.usageStatics is reliable when installed by npm.
Is the tui namespace always exist when code-snippet is used?

Copy link
Contributor Author

@sohee-lee7 sohee-lee7 Dec 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not sure that tui always exist. I'll revert this code.

@sohee-lee7 sohee-lee7 merged commit bdda85c into master Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants