1. Store a document for every unique
visitor per campaign in Elasticsearch.
Document contains:
a. Visitor related segment
properties like geo data,
platform information, referral,
etc.
b. Information related to
conversion of goals
2. Use Nested Types for creating
hierarchy between every unique
visitor’s visit and conversions.
3. Use Aggregations/Facets framework
for generating datewise count of
visitors and conversions and basic stats
like average and total revenue, sum of
squares of revenue, etc.
4. Never use script facets/aggs to get
counts of a combination of values from
the same document. Scripts are slow.
Instead index result of script at index
time.
Visitor documents in Elasticsearch:
{
"account": 196,
"experiment": 77,
"combination": "5",
"hit_time": "2014-07-09T23:21:15",
"ip": "71.12.234.0"
"os": "Android",
"os_version": "4.1.2",
"device": "Huawei Y301A2",
"device_type": "Mobile",
"touch_capable": true,
"browser": "Android",
"browser_version": "4.1.2",
"document_encoding": "UTF-8",
"user_language": "en-us",
"city": "Mandeville",
"country": "United States",
"region": "Louisiana",
"url": "https://vwo.com/free-
trial",
"query_params": [],
"direct_traffic": true,
"search_traffic": false,
"email_traffic": false,
"returning_visitor": false,
"converted_goals": [...],
...
}
How we use Elasticsearch
"converted_goals": [
{
"id": 2,
"facet_term": "5_2",
"conversion_time":
"2014-07-09T23:32:41"
},
{
"id": 6,
"facet_term": "5_6",
"conversion_time":
"2014-07-09T23:37:04"
}
]