In Dashly data is essentially fundamental for automating and personalizing communication with a user and for analytics, thus data collection should be properly set up for Dashly to be maximally useful.
"Data collection" is:
There are several methods for data collection:
Visitors data tracking.
An interface of admin panel, specialized for data collection setup not requiring coding.
Visitors data tracking is described in detail in our knowledge base.
This method is ideal for an easy start.
JavaScript library description
The easiest and recommended API using JavaScript on your site.
REST API (Web API)
Used for collecting data directly from your server, for example payment details.
In case you want to track visits of “Page1” page add following javascript into this page html:
dashly.track('Page1');
First argument - event name.
Second argument (optional) can be any number of additional attributes (event properties).
dashly.track(‘$product_viewed’, {
'$name': 'Dress',
'$url': 'http://example.com/dress',
'$amount': '3000',
'$img': 'http://example.com/dress.img',
});
Product viewed is a standard event, thus $product_viewed
key should be used as event name.
You can use REST API (example in CURL) if you are more comfortable with sending data directly from your server:
curl -X POST \
--data-urlencode "event=$product_viewed" \
--data-urlencode '$name=Dress' \
--data-urlencode "$url =http://example.com/dress" \
--data-urlencode "$amount=3000" \
--data-urlencode "$img=http://example.com/dress.img" \
-H "Authorization: Token XXX" \
"https://api.dashly.app/users/{userid}/events"
dashly.track('registered', {
'$email': 'test@mail.com',
'$phone': '8911177711',
'interesting_functions': ['chat', 'emaling']
});
For REST API (example in CURL):
curl -X POST \
--data-urlencode "event=registered" \
--data-urlencode '$email=test@mail.com' \
--data-urlencode "$phone=8911177711" \
--data-urlencode "interesting_functions=['chat', 'emaling']" \
-H "Authorization: Token XXX" \
https://api.dashly.app/users/{userid}/events
Javascript track method detailed description can be found here: Javascript API, track.
REST API post method for events here: REST API, Events.
The following javascript method is used to identify user’s properties in our system:
dashly.identify({
'nameProps': 'value',
});
Detailed descriptions of dashly.identify method.
Properties formats and list of standard properties is here.
For example get visitor’s email, phone and orders count on registry:
dashly.identify({
'$name': 'Maks',
'$email': 'super-maks@gmail.com',
'$orders_count': 6,
'RegDate': '2015-05-05T15:02:00'
});
For REST API (example in CURL)
curl -X POST \
--data-urlencode "operations=[
{"op": "update_or_create", "key": "$name", "value": "Maks"},
{"op": "update_or_create", "key": "$email", "value": "super-maks@gmail.com"},
{"op": "update_or_create", "key": "$orders_count", "value": "6"},
{"op": "update_or_create", "key": "RegDate", "value": "2015-05-05T15:02:00"}
]" \
-H "Authorization: Token XXX" \
https://api.dashly.app/users/8173131/props
All properties with names starting with $
are standard properties ($name
, $email
, $phone
, $orders_count
).
These are used in the interface, analytics and standard scenarios.
Thus, we strongly recommend collecting this data. All the rest are custom properties (you create them).
You are free to name them and choose data to store in them as you please.
Important! Custom properties names should not start with $
.