Beruflich Dokumente
Kultur Dokumente
USE CASEs
Table of Contents
Contents Page no
Time out in DTM 3
setInterval() 4
Use Cases
DTM rules load order 6
clearInterval(timerVariable)
Stops the executions of the function specified in the
setInterval() method.
setInterval() implementation:
Using setInterval() in combination with clearInterval() can really
help in tackling such situations. Here is the sample code
s.abort=true; //stopping the
default s.t()
var prodInterval = setInterval(prodWait, 100); //initiating
the setInterval
function prodWait() {
var temp=dtm_digitalData.guestID; //function which
repeats
if (temp) {
s.eVar1 = temp;
clearInterval(prodInterval); //stopping the
function
s.t();
}
}
In above piece of code, setInterval is using 100 milliseconds as a
ping time. This will keep checking the value of guestID after every
100 milliseconds. As soon as the value is available in temp
variable, the control will enter into the IF block and will
populated eVar1. Eventually clearInterval() function will also
get executed and will refrain setInterval from executing
furthermore.
s.abort=true stops default s.t() call from getting triggered.
The s.t() call gets triggered only when temp variable is
available and IF block gets executed.
Point to be note:
In above code snippet, s.t() is placed within IF block of
setInterval() function. Question arises here is that can we put
s.t() outside the function, after the setInterval() ?
The answer is simple no. There is a specific reason for this and
the reason is asynchronous nature of setInterval function. Yes,
setInterval runs asynchronously. When setInterval is called then
it starts running in parallel to the code written below. So if you
will put s.t() outside the function, image request will get fired
instantly and timeout logic would not work as desired.
If there are three critical pages say a, b and c on which you want
timeout to happen until the values from datalayer are available.
Then you would have to write three set interval functions for each
page and s.t() should be there within the functions only.
if (document.URL.indexOf(a.com") > -1){ // for
page a
s.abort=true;
var prodInterval = setInterval(prodWait, 100);
function prodWait(){
var temp=dtm_digitalData.productID;
if (temp){
s.products = temp;
clearInterval(prodInterval);
s.t();
}
}
}
<script type="text/javascript">_satellite.pageBottom();</script>
Uses Cases
1. What happens if pageBottom call is missing from the
page code?
The answer is - rules will still fire. Why, because assets JS of
DTM has a default pageBottom call. So, in case, it is missing
from the page code, the logic with in the asset file which check
for it and then it will fire the pageBottom call itself.
The only benefit of having a pageBottom within the page code
is that you can control the execution of bottom of the page
load rules.
Uses Case
1. What happens when there are more than one page load
rules firing together?
The answer is both rules will execute and will populate the
respective variables and then s.t() from the library will club the
variables from different rules together and fire a single image
request.
There is always a single Image request irrespective of number
of page load rules. As mentioned above, page load rules never
fire any image request themselves but they only set the
variables.
5. DTM Target Use case
There can be a situation where Adobe Target wants to personalize
the experience for the users who done certain activity and you want
to do that on the basis of cookies.
For e.g. you want to target visitors who would abandon the journey
while in the booking flow and in the subsequent visit they do a
purchase.
Solution In such situation a cookie can be dropped for every user
while they are in the booking journey. This cookie also have the visit
number.
If this user reaches the booking confirmation page, cookie will be
dropped otherwise cookie will stay.
On the next visit, we are going to capture the visit number and
compare it with the value stored in the cookie.
If the visit number == cookievalue +1 and booking abandon
cookie exists which means it is a subsequent visit.
So we will wait for the user to do a purchase. Once purchase is
done, another cookie will be dropped which will be picked up by
Target for personalization.
So thats how Target and DTM works together to get when it comes
to personalization for a specific audience.
Sample Code
var datenew = new Date();
datenew.setTime(datenew.getTime() + (365 * 24 * 60 * 60 * 1000));
var expires = "expires="+datenew.toUTCString();