Understanding Custom Attributes

Custom attributes allow users to add custom information to their subscribers to be used for segmentation and in turn targeted notifications. Custom attributes can be added in two different ways:

  1. Via Javascript API 
  2. Via REST API

Adding custom attributes via Javascript API (on page load)

Once you have added your website and integrated the tracking code into your site, you are able to start adding custom attributes. To do so simply open up the tracking code you installed on your site and add the custom attributes within the "attributes" object. 

Below is an example of adding the custom attribute "username" with a value of "djswan" as well as a custom attribute "age" with the value of "30". When adding this code via the javascript API our software will automatically attach it to the subscriber who is visiting the page. 

You may add as many attributes as you want to your account. The most recent attributes will override older ones, so if you mark "age":30 and then later make the call "age":"31", the subscriber will now have "age" 31 on their account.

	<!-- start aimtell tracking code --> 
	<script type='text/javascript'>
	    var _at = _at  {};
	    _at.domain = 'demo.aimtell.com';
	    _at.owner = 'b4f17229b267';
	    _at.idSite = '78';
	    _at.attributes = {"username": "djswan", "age": 30}; 
	    (function() {
	        var u='//api.aimtell.com/prod/';
	        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
	        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'trackpush.js'; 
	<!-- end aimtell tracking code -->

Adding custom attributes via Javascript API ( after page load )

You may add a custom attribute the current subscriber at any point by calling the _aimtellTrackAttributes javascript function. Below is an example

_aimtellTrackAttributes({"username":"djswan", "gender":"male"})

Adding custom attributes via REST API

To add the custom attributes via a REST call check out our documentation at  https://aimtell.readme.io/. Essentially you will just need to make an authenticated call and pass the custom data like the example below. Read our API documentation for more information on responses and limitations.

curl -XPUT -H 'X-Authorization: AUTH_TOKEN' -H "Content-type: application/json" -d '{
    "idSite": "1",
    "owner_uid": "ia123d",
    "username": "djswan",
    "age" : "30"
}' 'https://api.aimtell.com/prod/subscriber/27c2f4e2-8d30-168d-cdcb-69886cb80b79'

Verifying Attributes

To help in debugging event tracking, you can check out your logs under "Logs" -> "Attribute Logs" within your dashboard.