Web Designer Blog
The latest news and tips from the 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 »
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
2017
December
Working with Dynamic Text in Google Web Designer
Google Web Designer Tips - Part 1
April
Creating custom exits for dynamic remarketing crea...
March
Exploring text in Google Web Designer
2016
November
June
May
April
March
February
Feed
Follow @googlewdesigner