[Support request] Code Snippets Plugin to Add Adsense script Getting Syntax Error

Home Forums Support Code Snippets Plugin to Add Adsense script Getting Syntax Error

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #331335
    Richard Cannon

    Good evening,
    I have the Code Snippets plugin installed, and only need to copy-paste the Google script that is the initial step to connect my site to AdSense. The instructions are:
    Copy the code below
    2 Paste it into the HTML of https://www.site.com, between the <head> and </head> tags
    3 Check the box and click done when you finish

    the google script is: (i’ve hidden my ID)

    <script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: “xx-xxx-xxxxxxxxxxxxxxxxxx”,
    enable_page_level_ads: true
    });
    </script>

    Then i notify Google once that is done.
    When I paste the code into the code snippet editor and activate it, the Plugin deactivates the snippet and gives the message:

    The snippet has been deactivated due to an error on line 1:
    syntax error, unexpected ‘<‘

    The code is exactly as provided by Google. Thanks for any help.

    GeneratePress 1.3.47
    #331410
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You should add that code into the wp_head hook in GP Hooks instead of using Code Snippets.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.