Support » Plugin: Autoptimize » Autoptimize breaking Google Remarketing Code

  • Resolved rtkohl

    (@rtkohl)


    Hi, I am trying to add the google remarketing code below to my website (Ultimatebeautylaserspa.com). When I add it, Autoptimize does its thing and my SEO person says the code is not functioning. Is there a way for me to exclude this code from Autoptimize so that it just ignores it and does not change it? or is there something else I need to do?

    Rich

    <!– Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. For instructions on adding this tag and more information on the above requirements, read the setup guide: google.com/ads/remarketingsetup –>
    <script type=”text/javascript”>
    /* <![CDATA[ */
    var google_conversion_id = 980220964;
    var google_conversion_label = “nVttCNDEkVcQpPiz0wM”;
    var google_custom_params = window.google_tag_params;
    var google_remarketing_only = true;
    /* ]]> */
    </script>
    <script type=”text/javascript” src=”//www.googleadservices.com/pagead/conversion.js”>
    </script>
    <noscript>
    <div style=”display:inline;”>
    <img height=”1″ width=”1″ style=”border-style:none;” alt=”” src=”//googleads.g.doubleclick.net/pagead/viewthroughconversion/980220964/?value=1.00&currency_code=USD&label=nVttCNDEkVcQpPiz0wM&guid=ON&script=0″/>
    </div>
    </noscript>

    https://wordpress.org/plugins/autoptimize/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Frank Goossens

    (@futtta)

    As described in the FAQ you can exclude JS or CSS from aggregation/ optimization. In this case I would add “google_conversion_id, googleadservices” to the comma-seperated list of JS to exclude.

    Hope this helps,
    frank

    Thanks Frank, I just found that in the readme but was still not sure what to add to the JS exclude list. I will try your recommendation and see if that works for me.

    Thanks again.

    Rich

    Hi Frank, my SEO guy is still telling me its not working. Its still stripping out /* <![CDATA[ */ and this /* ]]> */ which I have been told I need.

    any thoughts on how to keep those?

    Sorry if these are basic questions I am still learning this stuff.

    Rich

    Plugin Author Frank Goossens

    (@futtta)

    The javascript optimizer (jsmin) indeed strips out the CDATA. As far as I know, those are utterly useless (relics of a time when some browsers had difficulties script-tags when in XML (XHTML) mode). If you really want to keep the CDATA-identifiers, you could enable the “look only in head”-option (assuming the JS in question is in the body, not the head).

    frank

    I am waiting to hear back from google if the CDATA line is actually needed or not.

    As for the fix I actually had to disable the optimize HTML code option to get those lines to remain. I thought if I told it to let the HTML comments remain that might solve it but it did not, I had to disable the HTML option altogether.

    I will see what Google tells me about those lines.

    Thanks for your help.

    Hi there, had the same issue. Finally found the following solution by reading the FAQ : just wrap the google code within <!–noptimize–> <!–/noptimize–> tags. It tells autoptimize to ignore what is within these tags. For instance :

    <!–noptimize–>
    <!– Google Code for Commande passée Conversion Page –>
    <script type=”text/javascript”>
    /* <![CDATA[ */
    var google_conversion_id = 983550975;
    var google_conversion_language = “en”;
    var google_conversion_format = “3”;
    var google_conversion_color = “ffffff”;
    var google_conversion_label = “9ZUeCIH1lVcQ_5f_1AM”;
    var google_remarketing_only = false;
    /* ]]> */
    </script>
    <script type=”text/javascript” src=”//www.googleadservices.com/pagead/conversion.js”>
    </script>
    <noscript>
    <div style=”display:inline;”>
    <img height=”1″ width=”1″ style=”border-style:none;” alt=”” src=”//www.googleadservices.com/pagead/conversion/983550975/?label=9ZUeCIH1lVcQ_5f_1AM&guid=ON&script=0″/>
    </div>
    </noscript>
    <!–/noptimize–>

    Plugin Author Frank Goossens

    (@futtta)

    That’s correct, nopitmize-tags will make sure everything (CDATA included) remains as is! Kudo’s to martinjerome 🙂

    martinjerome, that was exactly what I was looking for. Thanks, I guess I missed that when I was searching.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Autoptimize breaking Google Remarketing Code’ is closed to new replies.