In Dashly data is essentially fundamental for 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:

  • User properties identification. Properties can be standard (name, email, phone) or custom, your project-specific (for example, orders count, date of registration, projects count, revenue from client, etc.).
  • Tracking events. An event is a user action that you consider important (for example, making an order, registering, paying a subscription, visiting a page with tariffs, visiting a product page, etc.).

There are several methods for data collection: Track master. An interface of admin panel, specialized for data collection setup not requiring coding. Track master is described in detail in our knowledge base. This method is ideal for an easy start. Javascript API - The easiest and recommended API. JavaScript library description. * REST API(Web Api) – used for collecting data directly from your server, for example payment success. REST API description.

Utilizing Javascript API and REST API for data collection. There is a detailed description of Track master in our knowledge base.

Tracking events

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). Examples. 1. Track a “product viewed” event with additional data (name of product being viewed):

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" \
  --data-urlencode "auth_token=XXX" \
  "https://api.dashly.app/v1/users/{userid}/events"

  1. Track registration event with additional parameters: email, phone, list of options, chosen by visitor.
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']" \
  --data-urlencode "auth_token=XXX" \
  https://api.dashly.app/v1/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

Properties identification

The following javascript method is used to identify user’s properties in our system:

dashly.identify({
  'nameProps': 'value',
});

Properties values can be of following types:

  • integer
  • string
  • date/time
  • boolean
  • list

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"}
]" \
  --data-urlencode "auth_token=XXX" \
  https://api.dashly.app/v1/users/8173131/props

All properties with names starting with $ are standard ($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. Detailed dashly.identify method description. Properties formats and list of standard properties here

Important! Custom properties names should not start with $.