How to send data to SiteData

What is it? 

You can think of Sleeknote SiteData as a bucket where you can put in information.

When you put that information in the SiteData bucket, you can use it for several things, such as deciding if a campaign should show or not for a specific visitor, based on their basket value, basket items, operating system, and so on.


On an e-commerce website you have the information of what $ amount the current visitor has in the basket, and the customer wants to show a campaign for visitors with a basket total below $100.

To do that, the site should send the current $ total to Sleeknote SiteData, and then use the SiteData condition to show when that value is below 100.

How to use it

Sending Data Directly to SiteData

Sleeknote SiteData has a lot of similarities with Google Tag Manager's dataLayer.

To get the best performance of Sleeknote SiteData, follow these best practices:

  • Add the following snippet of code to the head of your page as far up as possible:

window.sleeknoteSiteData || (window.sleeknoteSiteData = []);


Whenever you want to add information to SiteData do the following:

window.sleeknoteSiteData.push({'attributeName': 1234});

attributeName is the name of the attribute you are sending to SiteData, and 1234 is the value.

If you send a string value to SiteData, it should be in quotes, following standard Javascript object notation.

window.sleeknoteSiteData.push({'attributeName': 'yes'});

Using Google Tag Manager to Send Data to SiteData

If you have data already available in Google Tag Manager it's very easy to send it to SiteData.

Send the data with a "Custom HTML" tag:

Tag content: 


window.sleeknoteSiteData || (window.sleeknoteSiteData = []);

window.sleeknoteSiteData.push({'VariableName': {{DL_Variable}}});


So in this example, you already have a GTM variable called DL_Variable that is now sent to the SiteData with the name "VariableName", whenever your GTM trigger fires the tag

Note the line:

window.sleeknoteSiteData || (window.sleeknoteSiteData = []);

Is actually not needed if you already have it defined in the header, but it won't do any harm if it's added both in the header and in the GTM tag.

Additional information

  • SiteData uses the browser's session storage, that means when the browser is closed, whatever is sent to SiteData is deleted. In practice that means that the attributes you want to send to SiteData have to be sent on the session where you want to use it.
  • If you send an attribute to SiteData twice with the same name, it will override the value to the last value sent.


window.sleeknoteSiteData.push({'BasketTotal': 50});

window.sleeknoteSiteData.push({'BasketTotal': 100});

Will result in the BasketTotal in SiteData being 100.

Tip: Download the Datalayer Checker extension if you have any doubts about what data your website is pushing to GTM