//segment.io
function addItemToShoppingcart (subItem) {
analytics.track('add', {
category: 'add item to shoppingcart from groupbuy choice page',
label: _groupId + '-item-' + subItem.id,
});
}
//GA sdk
function addItemToShoppingcart (subItem) {
ga('send', {
hitType: 'event',
eventCategory: 'add item to shoppingcart from groupbuy choice page',
eventAction: 'add',
eventLabel: _groupId + '-item-' + subItem.id
});
}
Marketing
Code
一切都在 Web Workspace 管理
將Code抽象化的四個元素
Tag|
Variable|
Trigger|
Data Layer|
Use case (3rd-Party Source Code)
Setting for reusing
Runtime condition
Push data manually (in code)
Example
- Tag
- Varible
- Trigger
蒐集所有使用者所Link點擊的URL
DataLayer
非由tag trigger主動觸發內容
<a href="#" name="button1" onclick="dataLayer.push({'event': 'button1-click'});">dataLayer.push()
Debug Tools
Debug Tools
Version Controll
Portability
Container
Import / Export
3-rd party Integration
> Google Analytics
> Zopim
> Amplitude
Google Analytics
1.使用 Tag 或 DataLayer 的時機
critical issue
https://developers.google.com/tag-manager/devguide
Tag Trigger 可能不如 js 靈活
太多 DataLayer 形同使用 ga sdk
Tag Event Properties 難以使用js產出的內容
交互使用讓GTM與Code仍舊耦合
Google Analytics
使用 Tag
- pageview
- common event
- js error check
- identify
使用 DataLayer
- custom pageview (a/b test)
- specific event
critical issue
Google Analytics
critical issue
2. 怕沒有100%還原,遺漏重要資訊
請看專案 analytics object
Google Analytics
critical issue
2. 怕沒有100%還原,遺漏重要資訊
客戶開發
Double Click ?
網站速度
請看ga
Amplitude
Custom HTML
SDK +
https://github.com/amplitude/GTM-Web-Demo/blob/master/amplitudejs-gtm.html
analytics.identify
Zopim
FB Pixal ?
fbq('track', 'AddToCart', {
content_ids: [subItem.id],
content_type: 'product',
value: _itemList[subItem.parentId].price,
currency: 'TWD',
});Custom HTML
SDK +
Thanks a lot