adding code in section not working
-
hello,
I’m trying to add some code in the <head> section of a website for tracking purposes, acting as specified in documentationthus, i’ve added this code in the functions.php theme file:
<script async src="https://cdn.ampproject.org/v0.js"></script> <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script> <amp-analytics type="nielsen"> <script type="application/json"> { "vars": { "apid": "F328C33C-5747-49C1-8F59-A396D28389B2", "prefix": "eu-", "apv": "1.0", "apn": "FIRSTonline Website", "section": "FIRSTonline_AMP", "segA": "NA", "segB": "NA", "segC": "Google AMP" } } </script> </amp-analytics>
once done, looking at the resulting page, some parts of the code are filtered (the two <script> tags to include src files are missing) and the remaining code is postponed AFTER the closing </head> tag (which is not good for my desired result).
It seems that something interferes reworking my code, but since no particular plugin is installed for such action, i’m wondering if i’m missing something or doing it completely wrong somehow…
I’ve also tried with the amp subfolder in the theme folder approach (copying the plugins/amp/templates/html-start.php file under the themes/mytheme/amp dir and editing it as needed with the code originally included in the functions.php file), obtaining more or less the same result.
Eventually, can someone suggest some alternative way to directly add the code I need in the <head> section?
plugin version is 2.1.3
wp version is 5.7.2thanks in advance for any help!
The page I need help with: [log in to see the link]
- The topic ‘adding code in section not working’ is closed to new replies.