• Resolved prtksng

    (@prtksng)


    I placed everything in place and still analytics don’t seem to work for the AMP. Did everything I could.

    Made a different GA property for AMP analytics, copied the tracking code and put it in the basic tracking template provided by Google and placed in this plugin’s analytics section without the HTML tags.

    Still Not working.

    I compared the code injected by this plugin with code shown on Google’s website and found some differences.

    • The script tags are inside the amp-analytics tags in contrary to what is on Google.
    • Also, the script tag seems to miss src attribute. See screenshot.

    Do you thing this could be the reason behind the failure because everything else is in place as recommended?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @prtksng!

    Could you provide a screenshot of what you placed in the plugin’s settings under AMP > Analytics?

    While the screenshot you provided looks generally correct, I notice that the id="tdm-amp-google-analytics" is not one generated by the plugin. Also, the type may need to be updated to gtag since you’re using the Global Site Tag configuration.

    Thread Starter prtksng

    (@prtksng)

    Hi, @reneesoffice .

    I am using Newspaper theme and they have a module for amp wherein there’s an option to put analytics code. The theme completely rely on this plugin and therefore, I think the code should work the same regardless of where it’s put. Theme’s amp module or this plugin’s analytics section.

    Still, to be as accurate as possible, I cut the code from theme’s module and pasted it into the plugin’s analytics section. And I noticed that the id you mentioned was gone. So, apparently, it was added by Newspaper theme.

    However, the type is still GoogleAnalytics.

    The point is it’s not working.

    This is the screenshot of the code that I put in the analytics section.

    And, this is the screenshot of the source code after replacing the code.

    My speculation is that the reason that this code is failing to work is because there’s no src attribute for the script tag for job completion and complete functioning and communication.

    @prtksng thanks for your reply.

    Have you tried to use the type gtag? In my testing, that worked for the code in the Global Site Tag format as you are using per the documentation

    When you mention the missing src attribute, are you referring to the first part of the code the documentation provides:

    <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>

    This is automatically placed by the AMP plugin and should be present on your site once you configure the settings. If you’d like to provide your URL we can check.

    As an alternative to both, my colleague’s recommendation in your other post for using Site Kit is an option.

    Thread Starter prtksng

    (@prtksng)

    Hello again. @reneesoffice

    I didn’t know that the type attribute can be modified by me(so stupid).

    I though this is added and controlled by plugin developers and can’t be modified without having to open and change the code. I overlooked the purpose textbox labelled type in the amp analytics section and put whatever I pleased.

    Also about the src attribute for script tag, I failed to consider the fact that this code can be anywhere on the page and not only nearby my analytic JSON configuration like in the documentation. Anyway, I searched the code in the view source page and found it which I, previously, though you guys forgot to add.

    I changed the type to gtag as you suggested and voila! it worked.

    So thanks a lot for the help. I would’ve never known that type is of great significance and not meant for the categorizing purpose which I mistakenly considered it to be.

    Thanks again and have a good day.

    @prtksng no problem at all! Glad that got it resolved.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Source(src) Missing From Analytics Section’s Script Tag.’ is closed to new replies.