Once created driven by our AdServer, the texts will change based on established parameters (Geolocation, weather, date/time, cookies, retargeting…).
To dynamize texts you have 4 methods at your service :
To make a text dynamic you must first create a text field. Once this text field is created, give it a name and keep this name in mind.
To write the code for the dynamization, select the Stage of the ads, click on {} and choose the event ‘compositionReady’, and write inside this event.
If you want to select your element use this: sym.$("myText")
.
If your element is inside a symbol use this: sym.getSymbol("mySymbol").$("myText")
.
The setText function allows you to insert a text in an element.
ADventori.Display.setText(element, data);
This function needs two parameters:
The adaptText function allows you to adapt the text size to its container.
ADventori.Display.adaptText(element, minFontSize);
This function needs two parameters:
The HTML tag targeted by this function must be a block element and have the following CSS properties: width
, height
, font-size
, line-height
.
To use the adaptText method, the container which uses this method can’t use the CSS property display:none
(please use opacity:0;visibility:hidden;
).
The setAndAdaptText function allows you to combine the two previous functions.
ADventori.Display.setAndAdaptText(element, data, minFontSize);
This function needs three parameters:
The element targeted by this function must be a block element and have the following CSS properties: width
, height
, font-size
, line-height
.
To use the setAndAdaptText method, the container which uses this method can’t use the CSS property display:none
(please use opacity:0;visibility:hidden;
).
You can also define the size of your container directly from the method setAndAdaptText:
ADventori.Display.setAndAdaptText(element, data, minFontSize, {width:XXX,height:XXX})
;
The verticalAlign function allows you to vertically align the text in its container.
ADventori.Display.verticalAlign(element);
This function needs one parameter:
The element targeted by this function must be a block element and have the following CSS properties: width
, height
, font-size
, line-height
.
To use the adaptText method, the container which uses this method can’t use the CSS property display:none
(please use opacity:0;visibility:hidden;
).