Documentation v.07


The attribute options

Include the window.attributeOptions option with your customizations before you include loader.js.
You have 4 options you can set: captureParams, onLoad, subdomain, and publicKey.
* By default, all URL paramaters upon page load, get sent into storage and saved under the name params . * A paid account us required for a publicKey . <script>
window.attributeOptions= {
captureParams: true,
onLoad: function(){},
subdomain: "example",
publicKey: "xkey123"
};
</script>
parameter type description
captureParams Boolean True by default. Set it to false if you don't want to capture URL paramaters on load, before you include the attribute javascript object.
onLoad Function An optional function you can use to detect when the iframe communication is established.
subdomain String False by default, using attribute.pro root domain. Set to a string, for a custom *.attribute.pro subdomain you'd like to namespace your data into.
publicKey String An account is required for a publicKey.

Object store

Include loader.js on your page. It's reccomended to place it inside the <head> element of your web pages:
<script src="https://attribute.pro/loader.js"></script>
Once you do, you'll have full capability of the attribute object.


attribute.set()

Allows you to set data into your users storage.
Takes 1 argument: data .

parameter type description
data Object The object you'd like to store.

Example:
attribute.set({hello: "attribute"}).then(console.log);
attribute.set() returns a Promise which resolves with a result object. This object has either:
  • result.data , the data you just set.
  • result.error , there was an error, and something went wrong.

attribute.get()

Allows you to get data into your users storage.
Takes 1 argument: name .

parameter type description
name String, Array, Null The location of the data. Use an array for multiple values. Use null for all.

Example:
attribute.get("name").then(console.log);
attribute.get() returns a Promise which resolves with a result object. This object has either:
  • result.data , the data you requested.
  • result.error , there was an error, and something went wrong.

attribute.delete()

Allows you to delete data from your users storage.
Takes 1 argument: name .

parameter type description
name String, Number, Null The location of the data. If null, delete all items in storage.

Example:
attribute.delete("name").then(console.log);
attribute.delete() returns a Promise which resolves with a result object. This object has either:
  • result.success , if the deletion was successful, this will be 'true'.
  • result.error , there was an error, and something went wrong.

attribute.sync()

Allows you to sync data from your users storage into anywhere (CRM, database, etc). If set, POST storage content when data is updated. This fires every time your users data changes.
Takes 1 argument: url .

parameter type description
url String The HTTP POST webhook where you want to send JSON to.

Example:
attribute.sync("https://url.com/webhook").then(console.log); attribute.sync() returns a Promise which resolves with a result object. It re-runs every time storage is updated. This object has either:
  • result.success , if the deletion was successful, this will be 'true'.
  • result.error , there was an error, and something went wrong.

Pixel

Need a way to consolidate all of your (non-javascript) tracking pixels into 1?
You just found it. This is the reference for how to use the parameters.

Include this image on your page, and the options through URL parameters as you see below.
<img src="https://attribute.pro/pixel.gif?"/>


* This only works with image based pixels , not javascript.
* By default, the IP address comes in through the x-forwarded-for header.


multiple pixels

Allows you to place any number of images into a single universal 1x1 transparent gif.
Takes 1 URL parameter: pixels , as a comma separated string ( ?pixels=url1,url2 ).

parameter type description
pixels String Comma separated string of full urls

Example:
<img src="https://attribute.pro/pixel.gif?pixels=https://url1.com/pix1.gif,https://url2.com/pix2.gif"/>

Our Our pixel returns a 1x1 transparent image which you can use on your own pages.


proxy image

Allows you to use any image instead of the default 1x1 transparent gif.
Takes 1 URL parameter: proxy , as a URL string ?proxy=url .

parameter type description
proxy String A URL string

Example:
<img src="https://attribute.pro/pixel.gif?proxy=https://url1.com/pix1.gif"/>

This replaces the default 1x1 transparent pixel , so you can stack tracking pixels on any image.


Person

Include the window.attributeOptions option with your customizations before you include loader.js.
* An account us required for a publicKey .
* You must whitelist the domain(s) from inside your account. <script>
window.attributeOptions= {
publicKey: "xkey123"
};
</script>

attribute.person.set()

Allows you to set data into your users storage.
Takes 2 arguments: email , data .

parameter type description
email String The email of the person you'd like to store data on.
data Object The object you'd like to store.

Example:
attribute.person.set('[email protected]', {hello: "attribute"}).then(console.log);
attribute.person.set() returns a Promise which resolves with a result object. This object has either:
  • result.success , will be true when data has been set.
  • result.error , there was an error, and something went wrong.

attribute.person.get()

Allows you to retrieve data from your cloud storage.
Takes 1 argument: email .

parameter type description
email String The email of the person you'd like to get data on.

Example:
attribute.person.get("[email protected]").then(console.log);
attribute.person.get() returns a Promise which resolves with a result object. This object has either:
  • result.data , the data you requested.
  • result.error , there was an error, and something went wrong.

attribute.person.delete()

Allows you to delete data from your cloud storage.
Takes 1 argument: email .

parameter type description
email String The email of the person you'd like to delete data on.

Example:
attribute.person.delete("[email protected]").then(console.log);
attribute.person.delete() returns a Promise which resolves with a result object. This object has either:
  • result.success , will be true if the data has been deleted.
  • result.error , there was an error, and something went wrong.