Google AdWords: remove iframe added by tracking conversion code

匿名 (未验证) 提交于 2019-12-03 02:45:02

问题:

I want to add Google AdWords to my site but the script I'm supposed to add creates an iframe in the dom. This iframe is visible and moves down 13px (its height) all my page.

Is there any way to avoid this? If not, can I hide it without affecting Google AdWords functionality? (It is an empty iframe).

回答1:

There's an easy fix that doesn't affect the functionality of the code snippet. I've done this with no adverse effects. Just place the script within a hidden div like below and it should do the trick:

<div style="display:none">   <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">   </script> </div> 


回答2:

@Mario is correct that there is a setting that will allow you to turn this display off. However, this setting doesn't seem to exist on the Google UI for remarketing tags, even though they do display this iframe (I think this is a bug on Google's end, as I imagine the "google_remarketing_only = true" flag was supposed to turn this iframe off and isn't working correctly).

I found out that you can also set this in the tracking JS by manually adding the flag "google_conversion_format = 3", like so:

<script type="text/javascript">     /* <![CDATA[ */     var google_conversion_id = 0123456789,         google_conversion_label = "XXXXXXXX",         google_custom_params = window.google_tag_params,         google_remarketing_only = true,         google_conversion_format = 3;     /* ]]> */ </script> <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"></script> 

This might be easier that regenerating the tags for some people, and solves the problem in the case that the UI doesn't support setting this option when generating the tags.



回答3:

I normally add this CSS(3) rule to the stylesheet:

iframe[name=google_conversion_frame]  {     display: none !important; } 

Hope it helps.



回答4:

you can also set max-height: 0; instead of display:none; Not sure of implications of display none on the iframe. This works back to ie6.

iframe[name="google_conversion_frame"] {     display: block;     max-height: 0; } 


回答5:

The best and simplest solution that I have come across for this issue is simply to remove the frame from the document flow by adding the following code to the css stylesheet:

iframe[name="google_conversion_frame"]{   position:fixed; } 

Hope this helps



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!