Title: Problem adding Google Ad Manager (DFP) Tags
Last modified: March 3, 2019

---

# Problem adding Google Ad Manager (DFP) Tags

 *  Resolved [bella2011](https://wordpress.org/support/users/bella2011/)
 * (@bella2011)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/problem-adding-google-ad-manager-dfp-tags/)
 * Hi there,
 * This is a great plugin! Works really well for inserting Google Adsense tags into
   a theme.
 * However, run across an issue with Google Ad Manager tags (formerly DFP).
 * When I use this tag, I receive an error message:
 *     ```
       <!-- /22394762/Article_728x90_ATF -->
       <div id='div-gpt-ad-3843543546464364-0' style='height:90px; width:728px;'>
       <script>
       googletag.cmd.push(function() { googletag.display('div-gpt-ad-3843543546464364-0'); });
       </script>
       </div>
       ```
   
 * This is the full snippet:
 *     ```
       function google_ads() {
       return '<!-- /22394762/Article_728x90_ATF -->
       <div id='div-gpt-ad-3843543546464364-0' style='height:90px; width:728px;'>
       <script>
       googletag.cmd.push(function() { googletag.display('div-gpt-ad-3843543546464364-0'); });
       </script>
       </div>';
       }
       add_shortcode('adsense-ros-atf', 'google_ads');
       ```
   
 * I receive PARSE ERRORS.
 * [https://www.dropbox.com/s/kqww1ju17rughzb/Screenshot%202019-03-02%2018.21.55.png?dl=0](https://www.dropbox.com/s/kqww1ju17rughzb/Screenshot%202019-03-02%2018.21.55.png?dl=0)
 * [https://www.dropbox.com/s/co0a7gzyxjh872p/Screenshot%202019-03-02%2018.21.59.png?dl=0](https://www.dropbox.com/s/co0a7gzyxjh872p/Screenshot%202019-03-02%2018.21.59.png?dl=0)
 * Is there a fix for this by chance?
    -  This topic was modified 7 years, 4 months ago by [bella2011](https://wordpress.org/support/users/bella2011/).
    -  This topic was modified 7 years, 4 months ago by [bella2011](https://wordpress.org/support/users/bella2011/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/problem-adding-google-ad-manager-dfp-tags/#post-11274931)
 * Hey,
 * Your HTML/JavaScript codes includes single quotation marks `'`, while also being
   enclosed in single quotation marks to make it into a PHP string.
 * In order to fix this, you can either use double quotation marks `"` to enclose
   the PHP string, or escape the single quotation marks inside the HTML/JS code 
   using a backslash `\'`:
 *     ```
       add_shortcode( 'adsense-ros-atf', function () {
       	return "<!-- /22394762/Article_728x90_ATF -->
       		<div id='div-gpt-ad-3843543546464364-0' style='height:90px; width:728px;'>
       			<script>googletag.cmd.push(function() { googletag.display('div-gpt-ad-3843543546464364-0'); });</script>
       		</div>";
       } );
       ```
   
 * Alternatively, you can use output buffering to remove the need to worry about
   PHP strings:
 *     ```
       add_shortcode( 'adsense-ros-atf', function () {
       	ob_start(); ?>
   
       <!-- /22394762/Article_728x90_ATF -->
       <div id='div-gpt-ad-3843543546464364-0' style='height:90px; width:728px;'>
       	<script>googletag.cmd.push(function() { googletag.display('div-gpt-ad-3843543546464364-0'); });</script>
       </div>
   
       	<?php
       	return ob_end_clean();
       } );
       ```
   
 *  Thread Starter [bella2011](https://wordpress.org/support/users/bella2011/)
 * (@bella2011)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/problem-adding-google-ad-manager-dfp-tags/#post-11278566)
 * Really helpful. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem adding Google Ad Manager (DFP) Tags’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

## Tags

 * [DFP](https://wordpress.org/support/topic-tag/dfp/)

 * 2 replies
 * 2 participants
 * Last reply from: [bella2011](https://wordpress.org/support/users/bella2011/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/problem-adding-google-ad-manager-dfp-tags/#post-11278566)
 * Status: resolved