• Resolved rodria

    (@rodria)


    This is more of a heads up: the .json file that ends up hosted on <site_url>/wp-content/plugins/accelerated-mobile-pages/includes/features/analytics/ga4.json may not work if the server that is hosting that file does not allow it to be retrieved from other sources.

    So, if the amp page ends up being hosted on google (when the url is like https://www.google.com/amp/s/<link_to_amp_article>), it cannot retrieve that file, giving a CORS error, and all those page views do not reach GA4.

    Right now, I am hosting the file on a different server, where I can setup the configuration of that file in order to be retrieved from a different origin. But I believe that most users who use this plugin and do not do that, will have trouble seeing the pageviews in GA4

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi, Thank you for reaching us, and sorry for the inconvenience caused you. Can you please let us know if the issue recurs after the recent update 1.0.86? Can you please check once by a rollback to the previous versions and confirm with us from which version you are facing the issues, So that we will analyze the issue and assist you accordingly in fixing the issue?

    Thread Starter rodria

    (@rodria)

    Hi Ahmed. I just saw the code of the new version and did not see changes where the issue is generated.

    The problem occurs when the configuration file ga4.json attempts to be loaded when the amp page is hosted on google. This is not possible on our servers due to a CORS error. And I believe is the case for most of the plugin users.

    We fixed the issue by hosting that file in another server and configuring it so that it can be loaded from different places.

    People with this error will only see it when they enter GA4 and notice a drop un the page views comparing to UA.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi, Thank you for the detailed info. If possible, Can you please share the URL of the website once? So that we will assist you to fix the issue ASAP!

    Thread Starter rodria

    (@rodria)

    Hi Ahmed. We no longer have the issue.

    We are hosting the ga4.json in a server where the configuration allows it to be called from a different server. And we modified the part of the plugin where the file is called.

    But I believe that this issue will occur for all the users who need a proper GA4 implementation.

    They will not see the pageviews of the amp posts that end up being hosted in google.

    Hi @rodria Can you please help us with the implementation? We’re unable to figure out GA4 implementation with the AMP version of our website.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    @rodria Hi, Can you please let us know, You are experiencing this after any specific recent updates or did you change anything recently? So that we will analyze the issue and assist you to fix it ASAP!

    Thread Starter rodria

    (@rodria)

    @ahmedkaludi , I will submit the issue in github. We fixed it on our side by modifying the code in the plugin. Also, this still happens in the updated plugin.

    @aryaayraarya I will answer in your thread.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi, We acknowledged this and it is a valid issue. We will fix this in the next update and once it gets done then we will get back to you with an update soon. Kindly refer to the GitHub link to track more updates: https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/5471

    Praveen Chauhan

    (@praveenchauhan1984)

    I was able to fix this issue using htaccess but an inbuilt solution in the plugin will be useful for everyone.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    @praveenchauhan1984 Hi, Yes. Currently, we are working on this solution in the upcoming update 1.0.87. We will notify you once we pushed the update very soon.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi, We fixed the bug in the latest update 1.0.87. Kindly update the AMPforWP plugin to the newest version and let us know if you face any issues. So that we will assist you in fixing them if you need any assistance.

    Praveen Chauhan

    (@praveenchauhan1984)

    Thanks You, Although i had fixed the issue using htaccess but now i removed my htaccess changes to see if the new update is working or not. It seems to be working fine now but i will monitor my analytics data for few days to make sure that it works fine.

    Thread Starter rodria

    (@rodria)

    Hi Ahmed, thanks for fixing the issue.

    I was the one who reported it on github. Although I didn’t update the plugin yet, I can see that you are now hosting the config file in an external server, which fixes the cors error.

    Thanks again for the quick fix!

    • This reply was modified 1 year, 4 months ago by rodria.
    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Hi, Thank you so much for the kind response. You’re welcome. If you have any other queries or issues further, Kindly feel free to reach us back, So that we will assist you to fix them if you need any assistance.

    Praveen Chauhan

    (@praveenchauhan1984)

    Hi Ahmed, After removing my htaccess the ga4 seems to have stopped tracking views on google cache as i can see difference in pageviews on universal analytics and ga4. so i think something is still causing the issue.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘GA4 does not receive pageviews when AMP page is hosted on google’ is closed to new replies.