Synthetic Classic has reached end of support and is no longer available. Existing Synthetic Classic customers have been upgraded to the all-in-one Dynatrace software intelligence platform.

Setting multiple cookies

If you have numerous scripts that cookies need to be set for, you can do this by creating an event hook that will attach a list of cookies to a request.

In the code, the variable cookieValues is created that can contain as many cookies as needed. The event hook then attaches the cookies to whichever URL you specify.

cookieValues = "cookie1=value1; " +
 "cookie2=value2; " +
 "cookie3=value3; " +
 "cookie4=value4; ";
 var send = new AddEventHookCommand({
 "eventType": "sendingRequest",
 "name": "setCustomCookie",

"handler":"if(request.getUrl() == ''){
alert('Setting Cookies'); var headers = request.getHeaders();
headers.replace('Cookie', cookieValues); }"

A demo script can be downloaded: setCookies.gsl.