AdWords
4.6K members online now
4.6K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me
star_border
Reply

Adwords Image Ads embedded SVGs being changed by upload tool

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Very similar to this post: https://www.en.advertisercommunity.com/t5/Advanced-Features/Embedded-SVG-is-broken-after-uploaded/m-...

 

What I've noticed is that SVGs that have self closing tags get improperly nested (altered) by the upload tool.

 

What begins life as:

<svg>

<path .... />

<path .... />

<path .... />

</svg>

 

Winds up as:

<svg>

<path ...... >

<path .......>

<path .......>

</path>

</path>

</path>

</svg>

 

Which completely mucks up the SVG image because paths that should be siblings are now children of the previous path.  

1 Expert replyverified_user

Re: Adwords Image Ads embedded SVGs being changed by upload tool

Community Manager
# 2
Community Manager
Hi Anthony,

Thanks for posting to the Community! In the case of the original thread you linked to, the reason the original poster was seeing issues was because it was not possible to embed the SVG into the HTML file to be accessed by JS. Is that similar to your case, or are there other details you can share with me about how you're trying to implement this?

Thanks!
Cassie

Re: Adwords Image Ads embedded SVGs being changed by upload tool

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Cassie,

Kinda sorta. SVG code that is inline in the HTML works fine for me. I can indeed access the SVG elements by ID and class using JS.

My problem is that Adwords manipulates the SVG structure at some point after I upload the file and breaks it. SVGs exported from Adobe Illustrator utilize self closing tags

i.e <rect x="12.6" y="430.1" class="cta-0" width="134.8" height="30"/>

https://dev.w3.org/html5/html-author/#tags here they basically say self closing tags are valid in HTML5 for void elements and also foreign elements such as SVGs.

The uploader tool is typically changing the above to:
<rect x="12.6" y="430.1" class="cta-0" width="134.8" height="30"></rect>

Which is perfectly legal too... but where the tool breaks down is if you have a bunch of rectangles one after another... it doesnt alter the code properly...So what you get is:

Original code:
<rect x="12.6" y="430.1" class="cta-0" width="134.8" height="30"/>
<rect x="12.6" y="430.1" class="cta-0" width="134.8" height="30"/>
<rect x="12.6" y="430.1" class="cta-0" width="134.8" height="30"/>

What is expected:
<rect x="12.6" y="430.1" class="cta-0" width="134.8" height="30"></rect>
<rect x="12.6" y="430.1" class="cta-0" width="134.8" height="30"></rect>
<rect x="12.6" y="430.1" class="cta-0" width="134.8" height="30"></rect>

What really happens:

<rect x="12.6" y="430.1" class="cta-0" width="134.8" height="30">
<rect x="12.6" y="430.1" class="cta-0" width="134.8" height="30">
<rect x="12.6" y="430.1" class="cta-0" width="134.8" height="30">
</rect>
</rect>
</rect>

See that the above causes the 3 rectangles that were supposed to be siblings to now become descendants of one another.... this causes the SVG to improperly render.

Hope that clarifies for you.

Re: Adwords Image Ads embedded SVGs being changed by upload tool

Community Manager
# 4
Community Manager
Thanks, Anthony. Please look out for an email from me so that I can get the full code you're using and share that with our tech team--from there, they can advise.

I'll post back here when we have a solution!

Cassie

Re: Adwords Image Ads embedded SVGs being changed by upload tool

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Thanks Cassie!

Re: Adwords Image Ads embedded SVGs being changed by upload tool

Community Manager
# 6
Community Manager
Hi everyone,

We heard back from the tech team and this is a known issue that they're working to fix. In the meantime, you can use this workaround:

Because the validator doesn't pick up on shorthand tag closing in a SVG, you will need to convert the shorthand notation "<path ... />" to full "<path ... ></path>" for the system to parse it as expected.

Thanks for your patience, and to Anthony for raising the issue!
Cassie

Re: Adwords Image Ads embedded SVGs being changed by upload tool

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
oh man awesome!

Adwords Image Ads embedded SVGs being changed by upload tool

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭

Is there any progress on a fix for this? I have 100s of ads that are affected by this and I can't fix them all by hand.