Note
Note: To learn more about Dynamic Creative Optimization (DCO), or to view guides about other authoring tools, see Introduction to dynamic creative.
This article describes how to manually define dynamic elements for HTML ads built in Google Web Designer (GWD).
The Dynamic Creative feature uses the Amazon Ad Server (AAS) creative AdKit for developers. AdKit includes ad-related functionalities that provide quick and easy development of your HTML ads.
Important
Important: To install the components required for building your ad, make sure that you follow the instructions in Create a rich media banner in Google Web Designer.
Define variables inside your config.js
file, and use the AdKit API to access these variables in your GWD project.
You can add variables for dynamic elements anywhere within the ad's JavaScript code. Dynamic elements are retrieved using the AdKit API. The following table describes the types of dynamic elements.
SV : svData |
Description |
---|---|
string |
Creates a dynamic element based on a string (raw text). |
html |
Creates a dynamic element based on an HTML string. |
image |
Creates a dynamic element based on an image. |
video |
Creates a dynamic element based on a video. |
The following example shows how to convert a text element that has the id BookPrice
into a dynamic element.
-
Open your creative in GWD.
-
Create an empty text element on the stage and provide an id, for example
BookPrice
. -
In the time line, go to the first frame and create a new event.
-
Add a new custom action in the event.
-
Use the following code snippet to load the dynamic variable to the text element.
function handleSVData(data) { document.getElementById("BookPrice").innerHTML = adkit.getSVData("dynamicPrice"); } adkit.onReady(handleSVData);
Note
Note: You will not see any dynamic text in the GWD preview. If you want to view the dynamic text, write inside the text area. Remember to delete this text before publishing the ad.
The JSON object in our example includes the following:
-
Open your
config.js
file. -
Add a JSON object to your file, as shown in the following example:
define( { "SV": { "svData": [{ "svKey": "dynamicImage", "svType": "image", "value": "my_img.jpg" }] } } );
-
Save your file.
-
Open your creative in GWD.
-
Drag the Amazon Dynamic Image component from the components library on to the stage.
-
In the Properties pane, enter the value for the SvKey field using the
svKey
from theconfig.js
. In this example, thesvKey
is dynamicImage.Note
Note: To preview in GWD, add the image that you want to view in the GWD Image Preview field.
-
Open your
config.js
file. -
Add a JSON object to your file, as shown in the following example:
define( { "SV": { "svData": [{ "svKey": "dynamicVideo", "svType": "video", "value": "my_video.mp4" }, { "svKey": "videoPoster", "svType": "image", "value": "poster.jpg" }] } } );
-
Save your file.
-
Open your creative in GWD.
-
Drag the Amazon Dynamic Simple Video component from the components library on to the stage.
-
In the Properties pane, enter the value for the MP4 Path svKey and the Poster Path svKey fields using the
svKey
from theconfig.js
. In this example, thesvKey
is videoFile and videoPoster.Note
Note: To preview in GWD, add the files that you want to view in the GWD Video Preview and GWD Poster Preview fields.
-
Open your
config.js
file. -
Add a JSON object to your file, as shown in the following example:
, define( { "SV": { "svData": [{ "svKey": "dynamicYTVideo", "svType": "String", "value": "abcxyz" }] } } );
-
Change the value abcxyz to the actual video ID of your YouTube video.
-
Save your file.
-
Open your creative in GWD.
-
Drag the Amazon Dynamic Youtube Video component from the components library on to the stage.
-
In the Properties pane, enter the value for the Youtube Id svKey field using the
svKey
from theconfig.js
. In this example, thesvKey
is youtubeVideo.Note
Note: To preview in GWD, add the Youtube ID that you want to view in the GWD YoutubeId Preview field.
Once you upload your ad to AAS , the Versions tab is available from the Ad Setup page. The Versions page includes the HTML and variable items that you defined in the config.js
file. For more information about versioning, see Work with versions of a dynamic creative ad.
Comments