Web Designer Blog
The latest news and tips from the Google Web Designer team
Google Web Designer Tips - Part 2
Wednesday, January 24, 2018
This document compiles the top tips collected from years of helping users on the
forum
, and from the
Google Web Designer blog posts
.
1. Writing custom actions for events
Issue
: when you need an action that is not available in the Events dialog.
Solution
: You can write custom actions in Google Web Designer easily using the following tips:
Use the
setTimeout
method to call a function or evaluate an expression after a specified number of milliseconds (see example 1 below).
Add an event to perform an action, then copy that action in Code view to use in your custom action (see example 1 below).
Use Code view to add a global variable (under the line window.gwd = window.gwd || {};) if you want to set a flag and only trigger an event when the condition is true (see example 2 below).
If you want to use an event that isn't listed in the Events panel (e.g. ‘change’), you can add an event that exists in the Events dialog, then edit it in Code view (see example 3 below).
Check our help page on
Component APIs
for properties, methods, events, and more examples.
Example 1: go to a different page after 5 seconds (use setTimeout)
Note: this tip can be used to go to another page after 30 seconds to meet the
AdWords requirements
that state animations cannot last longer than 30 seconds.
In this example, there is an animation that loops infinitely in the first page and a second page without any animation. We will add an event so that 5 seconds after the first page is shown, it will go to the second page.
To start, we want to find the code that goes to the second page so that we can use this in our custom action. This can be done by adding an event to go to the second page. The specific event doesn’t matter, since we're only concerned with the action at this point (going to the second page).
Open the Events panel and click on the + button to add an event.
Select the page ID for the first page as the Target.
Select
Mouse > Click
as the Event.
Select
Google Ad > Go to page
as the Action.
Select
gwd-ad
as the Receiver.
Select the second page (page1_1 in this example) in Configuration. You may also set other settings such as the transition type, duration, etc.
Click
OK
to save.
Switch to Code view and find: script type="text/javascript" gwd-events="handlers". Copy the action code for going to the second page.
Switch back to Design view. Now we will add the custom action to be triggered 5 seconds after the page is shown.
On the first page with animation, click the + button in the Events panel to add an event.
Select the first page ID as the Target.
Select
Page > Ready to present the page
as the Event.
Select
Custom > Add custom action
as the Action.
In the Custom Code dialog, name your function. In this case, you might use a name such as after5s. Then enter the following code, pasting the action code that you copied previously:
setTimeout(gotoPage, 5000); function gotoPage() { gwd.actions.gwdDoubleclick.goToPage('gwd-ad', 'page1_1', 'none', 1000, 'linear', 'top'); }
Click
OK
to save.
Remove the first event that you added just to generate the action code to copy:
You now have the
working file
that goes to the second page 5 seconds after the first page is shown.
Example 2: use timeline events to loop the ad through all pages twice.
In this example, the ad has 3 pages with animation, each with an event to go to the next page after the animation is finished.
The ad loops through all the pages twice, i.e., page 1 > page 2 > page 3, looping one more time and ending on page 3 after the second loop. Let’s add timeline events on each page to go to the next page at the end of the animation.
Add a timeline event to go to the next page at the end of the animation
On the first page, at the last keyframe, right-click on the Events layer and select
Add event
.
Double-click on the event marker to open the Events dialog.
Select
Google Ad > Go to page
as the Action.
Select
gwd-ad
as the Receiver.
In Configuration, select the page ID of the page to go to. In this example, it’s page2. You may also set other settings such as transition type, duration, etc.
Click
OK
to save.
You can edit this event by double-clicking on it in the Events panel.
Repeat the steps above to add timeline events for the other pages. On the last page, configure the event to go back to the first page.
The Events panel should show the following timeline events:
When you preview the ad, it will start with the first page, go to the next page at the end of the animation, and continue to loop. Next, we will set the ad to loop through the pages once and stop at page 3.
Use a counter to keep track of the loop
Add a global variable as a counter by going to Code view and searching for window.gwd.
After the window.gwd line, add the following code to initialize the counter: var counter = 1;
On the last page (page3 in this example), only go back to page1 if the counter is less than 2, then increment the counter. To do this, go to Code view, look for the action that goes to page1, and copy it. It'll look like this: gwd.actions.gwdDoubleclick.goToPage('gwd-ad', 'page1', 'none', 1000, 'linear', 'top');
In Design view, go to page 3, and double-click on the event marker at the end of the animation to add another timeline event. Select
Custom > Add custom action
in Action.
Type in a function name such as count.
In the code text area, enter code to check whether the counter is less than 2, paste the code to go to page 1, then increment the counter like this:
if (counter < 2) { gwd.actions.gwdDoubleclick.goToPage('gwd-ad', 'page1', 'none', 1000, 'linear', 'top'); counter++; }
Click
OK
to save.
In the Events panel, remove the timeline event on page3 that goes back to page1 now that we have the custom action with the counter to do that.
You now have the
working file
that loops twice through the 3 pages and stops at page 3.
Example 3: use custom events
In this example, you will draw a text input element on the stage and add a ‘change’ event to output the text content in the console when the Enter or Tab key is pressed.
Select the Element tool in the Toolbar.
Click on the custom element and type input in the Element field.
Draw the input element on the stage and give it an ID in the Properties panel.
Right-click on the input element on stage and select
Add event...
Select
Mouse > click
as the Event.
Select
Custom > Add custom action
as the Action.
Type in a function name such as myInputChange.
In the code text area, add the custom action to log the value of the input field to the console when it's changed:
inputContent = document.getElementById('input').value; console.log(inputContent)
Click
OK
to save.
Now we will replace the click event with a change event in Code view in 2 places:
When you switch back to Design view, you'll see the change event in the Events panel and you can edit it further as needed.
You now have the
working file
that outputs the input text content in the console window when there is a change event in the input field, i.e., the input’s value is committed on an Enter or Tab keypress.
2. Adding global variables in Design view
This tip describes how to add a global variable in Design view without switching to Code view.
Click on the plus button in the Events panel to add an event.
Select
document.body
as the Target.
Select
Google Ad > Ad initialized
as the Event.
Select
Custom > Add custom action
as the Action.
Give the function a name such as declareVars.
In the code section, declare and initialize your variables with the gwd. prefix such as gwd.myCounter = 0;
When the ad is initialized, the global variables can be used anywhere in your file.
Attached is the
example
that traces the gwd.myCounter variable in the browser console log using a timeline event at the first keyframe.
We hope you have enjoyed these tips, and don't forget to download the working files and give these solutions a try!
Posted by San K, Google Web Designer Team
Working with Dynamic Text in Google Web Designer
Tuesday, December 19, 2017
When working with dynamic text, you might encounter the problem where the text ends up longer than expected. If you have this issue, we have the solution! In this blog post you’ll learn to control your dynamic text while maintaining the integrity of your visual design.
Consider the following example: starting with a new blank file, let’s make the background gray, add 2 white divs, and place text elements on top. You can see that the text content is bound to the product name in the Dynamic panel.
When previewed, it looks like this:
But when adding extensive sample text, you’ll see this issue:
There are actually two issues occurring here: the right item text has become smaller, and it's also overflowing its container.
Truncation & Minimum Font Size
To fix both issues, let's switch to Code view and search for the gwd-text-helper tag following the body tag. Copy the code below and paste it inside the tag before the closing bracket.
gwd-fitting-truncate="true" gwd-min-font-size-px="7"
Now when previewed, it will look like this:
Much better. The text now stays within its bounding box due to truncation—but it might be a little small. That’s easy to adjust by editing the
gwd-min-font-size-px
attribute added above. Currently it's set to 7, but adjusting it to 12 may look better, and there are 2 ways to do that—either in the
gwd-text-helper
tag to specify a global setting for all text in your document, or to control each text element separately (common for headlines or titles), add the tag directly to the paragraph element like this:
You may also prevent text resizing entirely by using a
gwd-min-font-size-px
value equal to your initial size (16px in this case).
These controls should solve most dynamic text issues, but there is one case where you may want a little more control—the case of vertical centering. Let's duplicate the two text boxes and bind their content to products 2 & 3 (I’ve also adjusted the amount of text to demonstrate the issue):
Vertically Centering Dynamic Text
You may also want to vertically center text fields, so let's go ahead and do that for products 2 & 3. First wrap each text field in a new div by right-clicking the paragraph element and selecting “wrap”. We’ll also name the new div with the -ctn suffix, and use -txt for text elements to help keep things organized.
Double-click the new -ctn div to edit the paragraph element and apply these settings in the CSS panel:
left: 0
;
width: 100%
;
top
: should be de-selected
Change
height
to
max-height: 100%
Next open Code View and add the class
v-center
to the paragraph tag.
Repeat the above steps for both new text fields.
Finally, copy the following code and paste it at the end of the CSS styles in the "head" element of your document:
p {
margin: 0px;
}
.v-center {
position: relative;
top: 49%;
transform: translateY(-50%);
}
.v-bottom {
position: relative;
top: 100%;
transform: translateY(-100%);
}
Now when previewed, your text fields should be vertically centered as shown below:
Note the v-bottom class above can be used in cases where the text needs to be aligned at the bottom of its container.
With these three controls in hand (truncation, minimum font size, and vertical positioning), you should be able to solve the most common dynamic text formatting issues. Give these tips a try and let us know how they work for you in the comments!
Posted by Kent M, Google Web Designer
Google Web Designer Tips - Part 1
Friday, December 15, 2017
This document compiles the top tips collected from years of helping users on the
forum
, and from the
Google Web Designer blog posts
.
1. Use CSS transform for animation
Issue
: choppy animation when animating Top/Left/Width/Height.
Solution
: use CSS transform (
3D translation
and
scale
) for animation instead of Top/Left/Width/Height.
Google Web Designer defaults to CSS transform when creating CSS-based animation because the CSS transform property provides a higher frame rate and smoother animation. What this means is that when you use the selection tool to move an element or the transform tool to resize it in an animation, it will default to CSS transform (3D translation and scale section in the Properties panel) (see our
help
). However, many users change the Top/Left/Width/Height fields in the Properties panel when animating elements and this will cause choppy animation.
To avoid choppy animation, try using 3D translate X and Y for position, and 3D scale for size in the Properties panel when you animate elements. If you use the selection tool (or arrow tool) to move an element or the transform tool to resize an element, that should take care of it for you by default.
Note: if the animation of an image is choppy on IE when using CSS transform, wrap the image with animation in a div by right clicking on the image and selecting Wrap, then in the Properties panel of the parent div, set Selection 3D Rotation Z to 0.01 to workaround the issue.
2. Pixelation when using 3D scale for animation
Issue
: when using 3D scale for animation, the image becomes pixelated when scaled up.
Solution
: start with a large image that is the same size as the scaled up image. Add your starting and ending keyframes. At the starting keyframe, scale down the image using the Properties panel's 3D scale options. This creates an animation where the image grows in size without being pixelated.
3. Groups for reusable elements
Grouping objects creates a reusable element that can be placed in documents as "instances", which are references to the group's elements. Any change that is made to the group is reflected in all the instances of that group (see our
help
).
One example where groups are useful is a CTA button with an exit event that exists on different pages in the creative. Another benefit is that events for the elements in the group are retained in all instances of the group as long as the group instance has an ID assigned to it.
To create a group, right-click on the element on stage and select
Create Group...
You can then view the group in the Library panel and drag it on to the stage to create additional instances.
Groups are also used in the Swipeable and Carousel Galleries in dynamic creatives to display a custom layout for each product item in a collection. For example, you can create a group to display a product's image, name, description, price, etc., and this layout can be repeated for each product in the feed. This workflow will be described in a future dynamic tips blog post.
4. Make an element appear/disappear at a specific time during the animation
Issue
: how to create an animation with an element that needs to be hidden/shown at certain keyframes.
Solution
: use
opacity
and
step-end/step-start
easing. You can also watch the YouTube video on this topic
here
.
In this example, a div is hidden until the 3s mark. Then it is animated until 5s and disappears at 5s. To do this, let’s switch to the timeline’s Advanced mode then select the first keyframe. In the Properties panel of the element, set the opacity to 0 to hide the element.
Add the second keyframe where you want to show the element, at 3s in this example, and set the opacity of the element to 1.
At this point, if you preview, you will see that the element animates from 0 opacity to 1 because the easing is set to linear by default.
Right-click on the span between the keyframes and change the easing from linear to
step-end
. At this point, the element will not show until the second keyframe.
Add a third keyframe, at 5s in this example, and animate your element (in this example, it travels across the stage).
To hide the element again, add another keyframe at 5.5s, and set opacity to 0 and easing to step-start.
Then drag the keyframe so it’s right next to the keyframe at 5s.
Now you have accomplished turning an element on or off at a certain keyframe! You can view the
source file
or check out our
blog post
to use other ways to achieve the same effect.
5. How to replace an image without losing the events or animation
Issue
: some users build a new creative using an existing creative and want to easily change an image without losing events or animation.
Solution
: use
Swap image
in the context menu (see our
help
).
Select the image on the stage to be changed, right-click on it, and select
Swap image...
In the Swap image dialog, select the new image (if it’s already in the Library), or add a new image and select it. Click
OK
to save.
6. How to update an element’s size and position without affecting animation
Issue
: when building multi-size creatives, many users may start with one size, then build additional sizes using the first completed creative instead of using responsive design. In this workflow, it is necessary to update the element’s size and position in the new creative while keeping the animation the same.
Solution
: use CSS transform for animation (solution #1 in this post) , then update the Top, Left, Width, and Height properties in the
first keyframe in Advanced mode
to update the element’s position and size without affecting the animation.
When using animation, the best practice is to animate using CSS transform to avoid choppy animation. In addition to the performance benefit, you can also quickly update the element’s size and/or position without having to update all keyframes.
For example, let’s say you have a 100x100px element at the first keyframe like this:
In the second keyframe, it moves across the screen and shrinks to half of its size like this:
Now let’s say you’re building a bigger creative and the element has to be 200x200px. You can simply select the first keyframe and update the Width and Height properties. Since Width and Height are not used to animate the element, what you change in the first keyframe will propagate across all subsequent keyframes.
The element will now be 200x200px and travel across the screen by 200px with its size reduced in half:
7. How to loop the Swipeable Gallery infinitely
Issue
: when autoplay is set, the Swipeable Gallery only autoplays until the last frame and then returns to the first frame.
Solution
:
autoplay
the Swipeable Gallery infinitely by rotating once when the autoplay ends, and setting the rotation time and autoplay duration for smooth looping.
In this example, there are 3 images, autoplay is set in the Properties panel, and autoplay rotation is set to 3000 in the Advanced properties for the Swipeable Gallery. This means that the gallery autoplays from the first to the last frame in 3 seconds.
When you preview, you will see that the Swipeable Gallery autoplays once, then goes back to the first frame and stops. To autoplay it infinitely, add an autoplay ended event to rotate once forward.
Right-click on the Swipeable Gallery and select
Add event
.
Select Swipeable Gallery >
Autoplay ended
as the Event.
Select Swipeable Gallery >
Rotate once
as Action.
Select the Swipeable Gallery ID as the Receiver.
In Configuration, set the Rotation time to be the same as the autoplay duration. In this example, this is 3000 with forward direction.
Click OK to save.
You now have a
working file
that loops the Swipeable Gallery infinitely.
We hope you have enjoyed these tips, and don't forget to download the working files and give these solutions a try!
Posted by San K, Google Web Designer Team
Creating custom exits for dynamic remarketing creatives
Monday, April 3, 2017
Dynamic remarketing
is a great way to improve your advertising performance, especially if your goal is to sell more products. However, working with a dynamic creative can be tricky. Some of the values required by your creative, like call to action (CTA) text, Product Names, Exit URLs, etc., are not known ahead of time and come from a product "feed". Google Web Designer's Dynamic properties dialog can help you bind such values to elements in your creative, but what if you want to post-process these values before they are bound to your creative?
In this article, we will tackle one such case - adding a custom exit function to your dynamic remarketing creative, which lets you post-process the exit URL before exiting to it.
⚠
When working with a URL, take special care to generate a valid URL and keep in mind that some browsers have a maximum supported URL length.
Let's say you have created the six-product creative below for dynamic remarketing in DoubleClick Bid Manager.
Let’s begin by adding a custom exit for product 0:
Step 1: If applicable, remove the dynamic bindings for the "Exit Override URL" within the Tap Area component of product 0.
⚠
Without this change, clicking on your creative can lead to more than one exit.
Step 2: Select the tap area for product 0 (the first product).
Step 3: Add a new event for the tap area by clicking the "+" button on the Events panel.
Step 4: Select Tap Area > Touch/Click as the event.
Step 5: For the action, select Custom > Add custom action.
Step 6: Add a function name (e.g., mycustomexit0) then paste the below code snippet into the text area. Replace the comment with the logic for your custom post-processing, then click OK.
var exitURL = dynamicContent.Product_0_url
// Custom post-processing happens here
Enabler.dynamicExit("exit", exitURL, "0")
💡
Use Enabler.dynamicExit() instead of the traditional Enabler.exitOverride() for dynamic creative exits and pass in the product index as the third parameter. This helps Google's optimization engine understand which product was clicked on, and allows us to further improve performance of dynamic creatives.
Repeat the above steps for the other five products in the creative, changing the index accordingly, e.g., for the second product, use index 1, and so on.
To test your changes, follow the steps in the Bid Manager dynamic creative
help center article
to upload your creative in Bid Manager. Then, preview the creative and click on the products to verify your custom exits are working as expected.
Creating custom exits isn't so tricky after all! We've just shown you how your dynamic creative can use custom exits and send information about product-level clicks. If you require post-processing of exit URLs, try these steps with your creatives and let us know what you think in the comments below.
Posted by Manikandan, Software Engineer
Exploring text in Google Web Designer
Monday, March 13, 2017
In today’s blog post, we’ll show you how to manage the appearance of text throughout your Google Web Designer document. We’ll begin with simple changes, such as the font family, text weight, size or color. We’ll then show you how to make a new text element look like an existing one, and how to define default styles so you can reuse them easily.
Read more »
Google Web Designer training re-launched
Thursday, November 17, 2016
Google Web Designer training re-launches
: We’re thrilled to re-launch our core training for Google Web Designer, entitled “Get started with Google Web Designer”. This new Learning path and Achievement program has launched exclusively on Academy for Ads, Google’s hub for on-demand advertising training.
Take the training today
to learn the ins and outs of building HTML5 ads with the tool. Block off a couple hours to take the full learning path to develop the expertise you need to use Google Web Designer to the fullest.
Posted by Jasmine Rogers, on behalf of the Academy for Ads team
New usability features for Google Web Designer
Wednesday, November 16, 2016
We’re excited to introduce several new improvements to make Google Web Designer faster and easier to use. Whether you're copying and pasting across projects or dragging and dropping layers across the timeline, the tool allows you to work the way you need. Today, we're launching the following updates:
Timeline Enhancements:
Advanced Mode - Zoom:
Users can now zoom in and out of the timeline allowing for more precise placement of keyframes.
Multiple keyframe/thumbnail selection:
Easily select or delete all the keyframes (in Advanced mode) or thumbnails (in Quick Mode) in a layer at once.
Animate properties in the first thumbnail:
Quick Mode now allows editing the first keyframe and retaining the other keyframe properties.
Drag to hide/lock layers:
It is now possible to drag-select hide/lock icons in the layers instead of clicking each icon one by one. And users will still be able to click each layer to lock or hide, if desired.
New easing functions:
We have added two new easing functions for animation: step-start and step-end. Using these new functions for animated property values, users will gain more control over their animation transitions.
New easing functions for the animations in Google Web Designer
Copy/paste across documents
Any element that can be copied in the same document can now be copied to other documents, including assets and groups. In addition, if assets or other data conflicts, a dialog box will open to ask you to manually choose the resolution.
Preferences panel
Customize Google Web Designer to your style and workflow preferences in one central location. For example, you can set a number of Code View defaults including the color theme and preferred keymap.
JavaScript library support
DoubleClick Studio users can now easily import the Greensock JS Library for creatives made in Google Web Designer. You can also add a variety of plugins including TweenLite, TweenMax, and Text Plugins to help you build your creatives.
JavaScript library support in Google Web Designer
Today, we also launched a new Google Web Designer Learning path on
Academy for Ads
. This resource can help you learn the ins and outs of Google Web Designer in quick, five minute modules or dedicate more time to working through the full Learning path.
Ready to get started? Check out our Google Web Designer
ad gallery
for inspiration. If you’ve already downloaded Google Web Designer, it will automatically update to reflect the new features listed above. If you haven’t yet downloaded the tool, you can
download it for free here
.
Posted by Jasmine Rogers, Program Manager, Google Web Designer
Labels
3D
animation
animations
BYOC
carousel
clips
css
CTA
custom code
Display
DoubleClick Bid Manager
DoubleClick Studio
dynamic
engagement ads
English
events
exit
fluid layout
gallery
google cultural institute
google web designer
Google Web Designer Blog
groups
HTML5
javascript
lightbox
looping
masking
new release
new version
pages
publish
responsive
sales animation
swatches
swipeable
text
timeline
UI
Archive
2018
January
Google Web Designer Tips - Part 2
2017
December
April
March
2016
November
June
May
April
March
February
Feed
Follow @googlewdesigner