As we all know ,Data Elements can store values from your own data layer object, cookies, local storage objects, query string parameters, page elements, meta tags, etc. It was designed to return a value for use across page load, event triggered and direct call rules, and validity period depends on Storage Duration.
But one is special. Constants, its value are constant，. There are ten data elements that can pass dynamic values:
- Custom Code
- DOM Attribute
- Local Storage
- Page Info
- Query String Parameter
- Random Number
- Session Storage
- Visitor Behavior
Let’s take a look at how to use them one by one.
Cookies: Cookies can be read into stored data elements, only first-party cookies can be read. It can be used later by Rules and Extensions.
For example, open my blog http://www.bbccss.com, and then open the developer tools, find Application, click on it, and then click on the Cookies on the left. All the cookies shown here are cookies:
Note the Domain column, some of them belong to my domain name bbccss.com, these are first-party cookies, some are of other domain names, these are third-party cookies, such as doubleclick.net shown in the figure above.
The cookie in the data element can only capture the first-party cookie. Now suppose I want to capture the _ga cookie. The settings in Launch are as follows:
Custom code can process the data through js and then return the value.
For example, this can be used to classify the page, and this data element can be referenced by the Channel.
DOM Attribute can scrapes a value from the DOM. The values on the page can be fetched this way.
For instance, I want to crawl Slogan of my blog:
Move the mouse to this position, then right-click and select Inspect. You will see the code of the mouse position:
Move the mouse to the code position, right-click and select Copy, then select Copy selector.
Paste to “From the DOM element matching the CSS Selector”, use the value of select text, details as follows:
#header> div.container-inner> div> a> h1> span.g-bloger（Css Selector） is the positioning page element, and text is telling Adobe Launch which value to get.
Some data layers look like this:
The configuration of the first way is as follows:
The configuration of the second method is as follows:
In fact, there is a lot of information that can be obtained this way. Open your browser’s dev Tools window. Click on the Console tab at the top and type window:
We can see what information is stored in Local Storage. Open my blog, then open the developer tools, select Application, click LocalStorage:
This information is stored in Local Storage，Unlike cookies, Web Storage (Session Storage and Local Storage)data does not get passed to the server unless you actively pull the data out of storage and send it.
Every data element value that Launch stores has a key that begins with com.adobe.reactor.dataElements..The structure is com.adobe.reactor.dataElements. + Item, you don’t need to fill in the whole, you only need to fill in the items, for example, I want to get com.adobe.reactor.dataElements.Cookie-ga, set as follows:
A lot of built-in Page Info information can be used by Rules and Extensions just by configuring it.
Query String Parameter
Query String Parameter can get some key-value pair information on the URL. Is to get the information on the url to pass to the data element.
For example, the URL is https: //www.bbccss.com&cid=google. I want to get the value of Google. I can set it like this:
Note that there is a checkbox next to it, whether it needs to be case sensitive.
The random number is to generate a random number, and the generated value is an integer.
See the usage of Local Storage.
Built-in user behavior information, just need to configure it to be used by Rules and Extensions. If you pay attention, you will find that Visitor Behavior is similar to Local Storage and Session Storage information, because Visitor Behavior is obtained using Web Storage (Local Storage and Session Storage)
The setting method is as follows: