99 lines
10 KiB
Go
99 lines
10 KiB
Go
|
package piwik
|
||
|
|
||
|
import "time"
|
||
|
|
||
|
type SiteStorageInterface interface {
|
||
|
Add(site *Site) error
|
||
|
Remove(site *Site) error
|
||
|
Update(site *Site) error
|
||
|
List() ([]*Site, error)
|
||
|
FindId(id string) (*Site, error)
|
||
|
Find(query map[string]interface{}) (*Site, error)
|
||
|
FindAll(query map[string]interface{}) ([]*Site, error)
|
||
|
}
|
||
|
|
||
|
type VisitStorageInterface interface {
|
||
|
Add(visit *Visit) error
|
||
|
Find(query map[string]interface{}) (*Visit, error)
|
||
|
FindAll(query map[string]interface{}) ([]*Visit, error)
|
||
|
}
|
||
|
|
||
|
type Site struct {
|
||
|
ID string `bson:"_id" json:"id"`
|
||
|
Name string `bson:"name" json:"name"`
|
||
|
Domain string `bson:"domain" json:"domain"`
|
||
|
}
|
||
|
|
||
|
type Visit struct {
|
||
|
ID string `bson:"_id" json:"id"`
|
||
|
SiteID string `bson:"site_id" json:"site_id"` //idsite
|
||
|
URL string `bson:"url" json:"url"` //url
|
||
|
ActionName string `bson:"action_name,omitempty" json:"action_name,omitempty"` //action_anem
|
||
|
VisitorID string `bson:"visitor_id,omitempty" json:"visitor_id,omitempty"` //_id
|
||
|
Referrer string `bson:"referrer,omitempty" json:"referrer,omitempty"` //urlref
|
||
|
CustomVars map[string]interface{} `bson:"custom_vars,omitempty" json:"custom_vars,omitempty"` //_cvar
|
||
|
VisitsCount string `bson:"visits_count,omitempty" json:"visits_count,omitempty"` //_idvc
|
||
|
ViewTime time.Time `bson:"view_time,omitempty" json:"view_time,omitempty"` //_viewts
|
||
|
VisitorFirstVisitTime time.Time `bson:"visitor_first_visit_time,omitempty" json:"visitor_first_visit_time,omitempty"` //_idts
|
||
|
CampaignName string `bson:"campaign_name,omitempty" json:"campaign_name,omitempty"` //_rcn
|
||
|
CampaignKeyword string `bson:"campaign_keyword,omitempty" json:"campaign_keyword,omitempty"` //_rck
|
||
|
Resolution string `bson:"resolution,omitempty" json:"resolution,omitempty"` //res
|
||
|
LocalHour string `bson:"local_hour,omitempty" json:"local_hour,omitempty"` //h
|
||
|
LocalMinute string `bson:"local_minute,omitempty" json:"local_minute,omitempty"` //m
|
||
|
LocalSeconds string `bson:"local_seconds,omitempty" json:"local_seconds,omitempty"` //s
|
||
|
LocalTimeUTC time.Time `bson:"local_time_utc,omitempty" json:"local_time_utc,omitempty"`
|
||
|
Plugins *Plugins `bson:"plugins" json:"plugins"`
|
||
|
SupportsCookies bool `bson:"supports_cookies,omitempty" json:"supports_cookies,omitempty"` //cookie
|
||
|
UserAgent string `bson:"user_agent,omitempty" json:"user_agent,omitempty"` //ua
|
||
|
Language string `bson:"language,omitempty" json:"language,omitempty"` //lang
|
||
|
UserID string `bson:"user_id,omitempty" json:"user_id,omitempty"` //uid
|
||
|
CustomUserID string `bson:"custom_user_id,omitempty" json:"custom_user_id,omitempty"` //cid
|
||
|
NewVisit bool `bson:"new_visit,omitempty" json:"new_visit,omitempty"` //new_visit
|
||
|
PageCustomVars map[string]interface{} `bson:"page_custom_vars,omitempty" json:"page_custom_vars,omitempty"` //cvar
|
||
|
Link string `bson:"link,omitempty" json:"link,omitempty"` //link
|
||
|
Download string `bson:"download,omitempty" json:"download,omitempty"` //download
|
||
|
Search string `bson:"search,omitempty" json:"search,omitempty"` //search
|
||
|
SearchCategory string `bson:"search_category,omitempty" json:"search_category,omitempty"` //search_cat
|
||
|
SearchCount string `bson:"search_count,omitempty" json:"search_count,omitempty"` //search_count
|
||
|
PageViewID string `bson:"page_view_id,omitempty" json:"page_view_id,omitempty"` //pv_id
|
||
|
GoalID string `bson:"goal_id,omitempty" json:"goal_id,omitempty"` //idgoal
|
||
|
Revenue string `bson:"revenue,omitempty" json:"revenue,omitempty"` //revenue
|
||
|
GenerationTime string `bson:"generation_time,omitempty" json:"generation_time,omitempty"` //gt_ms
|
||
|
Characterset string `bson:"characterset,omitempty" json:"characterset,omitempty"` //cs
|
||
|
EventCategory string `bson:"event_category,omitempty" json:"event_category,omitempty"` //e_c
|
||
|
EventAction string `bson:"event_action,omitempty" json:"event_action,omitempty"` //e_a
|
||
|
EventName string `bson:"event_name,omitempty" json:"event_name,omitempty"` //e_n
|
||
|
EventValue string `bson:"event_value,omitempty" json:"event_value,omitempty"` //e_v
|
||
|
ContentName string `bson:"content_name,omitempty" json:"content_name,omitempty"` //c_n
|
||
|
ContentPiece string `bson:"content_piece,omitempty" json:"content_piece,omitempty"` //c_p
|
||
|
ContentTarget string `bson:"content_target,omitempty" json:"content_target,omitempty"` //c_t
|
||
|
ContentInteraction string `bson:"content_interaction,omitempty" json:"content_interaction,omitempty"` //c_i
|
||
|
ECommerceID string `bson:"ecommerce_id,omitempty" json:"ecommerce_id,omitempty"` // ec_id
|
||
|
ECommerceItems [][]string `bson:"ecommerce_items,omitempty" json:"ecommerce_items,omitempty"` // ec_items
|
||
|
ECommerceSubTotal string `bson:"ecommerce_sub_total,omitempty" json:"ecommerce_sub_total,omitempty"` // ec_st
|
||
|
ECommerceTax string `bson:"ecommerce_tax,omitempty" json:"ecommerce_tax,omitempty"` // ec_tx
|
||
|
ECommerceShipping string `bson:"ecommerce_shipping,omitempty" json:"ecommerce_shipping,omitempty"` // ec_sh
|
||
|
ECommerceDiscount string `bson:"ecommerce_discount,omitempty" json:"ecommerce_discount,omitempty"` // ec_dt
|
||
|
ECommerceTime time.Time `bson:"ecommerce_time,omitempty" json:"ecommerce_time,omitempty"` // ec_ts
|
||
|
TokenAuth string `bson:"token_auth,omitempty" json:"token_auth,omitempty"` //token_auth
|
||
|
CustomIP string `bson:"custom_ip,omitempty" json:"custom_ip,omitempty"` //cip
|
||
|
CustomDateTime string `bson:"custom_date_time,omitempty" json:"custom_date_time,omitempty"` //cdt
|
||
|
CustomCountry string `bson:"custom_country,omitempty" json:"custom_country,omitempty"` //country
|
||
|
CustomRegion string `bson:"custom_region,omitempty" json:"custom_region,omitempty"` //region
|
||
|
CustomCity string `bson:"custom_city,omitempty" json:"custom_city,omitempty"` //city
|
||
|
CustomLatitude string `bson:"custom_latitude,omitempty" json:"custom_latitude,omitempty"` //lat
|
||
|
CustomLongitude string `bson:"custom_longitude,omitempty" json:"custom_longitude,omitempty"` //long
|
||
|
MediaID string `bson:"media_id,omitempty" json:"media_id,omitempty"` // ma_id
|
||
|
MediaTitle string `bson:"media_title,omitempty" json:"media_title,omitempty"` // ma_ti
|
||
|
MediaResource string `bson:"media_resource,omitempty" json:"media_resource,omitempty"` // ma_re
|
||
|
MediaType string `bson:"media_type,omitempty" json:"media_type,omitempty"` // ma_mt
|
||
|
MediaPlayerName string `bson:"media_player_name,omitempty" json:"media_player_name,omitempty"` // ma_pn
|
||
|
MediaSecondsPlayingTime string `bson:"media_seconds_playing_time,omitempty" json:"media_seconds_playing_time,omitempty"` // ma_st
|
||
|
MediaLength string `bson:"media_length,omitempty" json:"media_length,omitempty"` // ma_le
|
||
|
MediaProgress string `bson:"media_progress,omitempty" json:"media_progress,omitempty"` // ma_ps
|
||
|
MediaTimeUntilPlay string `bson:"media_time_until_play,omitempty" json:"media_time_until_play,omitempty"` // ma_ttp
|
||
|
MediaWidth string `bson:"media_width,omitempty" json:"media_width,omitempty"` // ma_w
|
||
|
MediaHeight string `bson:"media_height,omitempty" json:"media_height,omitempty"` // ma_h
|
||
|
MediaFullscreen bool `bson:"media_fullscreen,omitempty" json:"media_fullscreen,omitempty"` // ma_fs
|
||
|
}
|