Understanding Lytics / Product Documentation / Lytics Javascript Tag

Sending Web Data

The Lytics JavaScript tag makes sending behavioral data from your website easy. By installing our tag you will automatically begin to collect page view related information. By default the following raw fields are included along with any custom data, as described below.

Default Data Collected

KeySample ValueDescription
_epvThe type of event responsible for the event emission. pv for example represents a page view
_refwww.getlytics.comThe referral domain.
_tz-7An integer representation of the user's time zone. Integer represents the difference between current time and standard UTC time. PST for example would be -7
_ulen-USThe users language as derived from the browser.
_sz2560x1440The size of the users display.
_ts1504306728695The current time represented by milliseconds since Unix Epoch.
_nmobtIf page is being consumed on a mobile device or not. _nmob:true represents not mobile
_devicedesktopThe users current device type.
urlwww.getlytics.comThe url where the data was sent from.
_uid74481.3222228897The users Lytics _uid or cookie id.
_v2.1.0Version number of the JavaScript tag that sent the data.

Sending Data

Sending data from your website to Lytics is very easy. With the Lytics JavaScript tag installed you simple make a call to our jstag.send() method. For example, jstag.send({"name":"Mark"});, will send the key of name and the value of Mark to the default stream along with the default data outlined above.

The send method accepts two optional and one required parameter jstag.send(stream, data, callback):

streamstringNjstag.send('mycustomstream', {"name":"Mark"})The custom stream to pass the event to. By default this is generally controlled at the JavaScript tag config level and not used in practice.
dataobjectYjstag.send({"name":"Mark"})A JavaScript object. We can accept any key/value pairs but keep in mind only the defaults defined in this documentation will be mapped by default. All other custom keys will require support from the Lytics team.
callbackfunctionNjstag.send({"name":"Mark"}, function(){alert('doing a thing')})A callback can be passed along with any event as well. This is common when working with form data or anything that requires an action to be taken after the data has successfully been sent to Lytics.

Example Payloads for Pre-Mapped Data

User Identity

  userid: "1234",
  facebook_id: "abc123",
  twitter_id: "def123",
  linkedin_id: "hij123",
  email: "[email protected]",
  name: "Jon Snow",
  first_name: "Jon",
  last_name: "Snow",
  title: "King in the North",
  company: "House Stark",
  phone: "555-555-5555",
  cell: "555-555-5555",
  age: 21,
  gender: "m",
  city: "Winterfell",
  state: "Westeros",
  country: "IE",
  zip: "55555",
  origin: "organic",
  status: "unknown"

Dynamic Attributes

Dynamic attributes allow you to define new user attributes that are not in the default list above. By adding attr_ to the beginning of any key passed in your send event Lytics will add a dynamic attribute to the profile and make it available for use in audiences.

It is important to note that dynamic attributes will map all of these keys to a single field on a user profile. If you are mapping a lot of attributes to a profile, it might make more sense to map these to separate fields. Additionally, all dynamic attributes are mapped as strings so if you want to segment on a different data type (e.g. date, number, boolean) then you would need to create a new field.

  status: "filming",
  attr_combatrating: 10,
  attr_pet: "Dire Wolf"

Event Data

  event: "rescued sansa" // required

Conversion Data

  event: "conversion",                 // required
  campaign_id: "someconversionid",     // optional
  variation_id: "somevariationid",     // optional
  currency: "USD",                     // optional
  value: 25.99                         // optional