Class: Storage

ATInternet.Tracker.Plugins. Storage

Plugin to manage stored data.

new ATInternet.Tracker.Plugins.Storage(tag)

This plugin allows the storage of elements such as strings, tables or objects. It uses serialization. For that reason the values must be JSON compatible.
Name Type Description
tag object Instance of the Tag used

Methods

cacheInvalidation()

Clear the cache
Delete a data or its property
Name Type Description
key string | Array If a string, name the element you wan to create/update, if an array the first element is the data's name and the second is its property

delPrivate(key)

Same as the 'del' method but for a private data linked to the current numsite
Name Type Description
key string | Array

get(key, byPassCache){*}

Retrieve a stored data or a its property.
Name Type Description
key string | Array If a string, the data's name, if an array the first element is the data's name and the second is the property's name
byPassCache boolean optional If true, the value will be directly retrieved from storage
Returns:
null if the element does not exist

getAll(){Object}

Retrieve all stored data.

getPrivate(key, byPassCache){*}

Same as the 'get' method but for a private stored data linked to the current numsite.
Name Type Description
key string | Array If a string, the data's name, if an array the first element is the data's name and the second is the property's name
byPassCache boolean optional If true, the value will be directly retrieved from cookie or local storage
Returns:
null if the element does not exist

set(key, val, options, force){boolean|null}

Create, update or erase a stored data or its property.
Name Type Description
key string | Array If a string, name the element you want to create/update, if an array the first element is the data's name and the second is its property
val * Value to save
options object Object which contains options. Useless if you create or update a property.
force boolean Force cookie writing when "consent page mode" is activated
Returns:
true if the data has been set
Example
set('cookie', 'value', {end: '3600', domain: '.site.com', path: '/', secure: true});
set('cookie', [1, 2, 3], {end: '3600'});
set('cookie', {'myvar1': 1, 'myvar2': 2}, {session: '3600'});
set(['cookie', 'myvar2'], 3);

var date = new Date;
date.setMinutes(date.getMinutes() + 30);
set('cookie', 'value', {end: date.getMinutes() + 30});

setPrivate(){boolean|null}

Same as the 'set' method but for a private data linked to the current numsite
Returns:
true if the data has been set