question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AMP-Analytics: Errors with Google Tag-Manager

See original GitHub issue

What’s the issue?

A change made in the following PR is resulting in the __amp_source_origin to be excluded from requests to an amp-analytics config file. https://github.com/ampproject/amphtml/pull/12787

Google Tag Manager appears to omit all CORS headers unless this GET parameter is included. Because Access-Control-Allow-Origin: * is therefore not included by GTM, the browser throws the following error:

Failed to load https://www.googletagmanager.com/amp.json?id=GTM-KCTM85F&gtm.url=https%3A%2F%2Fwww.simgolf.dk%2F: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘https://www.simgolf.dk’ is therefore not allowed access. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

How do we reproduce the issue?

One example provided in the #general Slack channel was for https://www.simgolf.dk/

What browsers are affected?

I am assuming all.

Which AMP version is affected?

The latest build: https://github.com/ampproject/amphtml/releases/tag/1516396600278

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:31 (17 by maintainers)

github_iconTop GitHub Comments

22reactions
david-aacommented, Nov 14, 2018

Any Update? Due to this I was stuck and can not able to use gtm in my page

Maybe it’s a silly question but, have you published your GTM container?

4reactions
sryzecommented, Mar 8, 2018

I’m experiencing the same issue, even though it was said that the fix has been released. Do I need to change something in Google Tag Manager configuration?

Failed to load https://www.googletagmanager.com/amp.json?id=MY_ID&gtm.url=https%3A%2…mysite.com&__amp_source_origin=https%3A%2F%2Fwww.mysite.com: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.mysite.com' is therefore not allowed access. The response had HTTP status code 403. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Read more comments on GitHub >

github_iconTop Results From Across the Web

AMP validation errors with GTM [#3217726] | Drupal.org
I am using Google Tag which is working great. Problem/Motivation For the time being, after applied the AMP on my site using AMP...
Read more >
Tracking error after installing Amp Google Tag Ad manager
I have just installed Google Ad Manager Amp ads on my site but have now started to receive a few console errors. Page...
Read more >
Tag Manager and AMP pages issue - WordPress.org
2) Before using Site Kit I used only Analytics code in AMP and non-AMP pages. I didn't use GTM. I migrated to GTM...
Read more >
google analytics - Tag Manager not firing on AMP pages
You can check here the possible causes for tag firing problems: Unpublished changes; Wrong trigger configuration; Triggers too specific; Unexpected site or app ......
Read more >
Fix Google Tag Manager & Google Analytics for AMP Plugin Issues ...
But there are some common steps for troubleshooting compatibility issues with plugins like Google Tag Manager & Google Analytics for AMP Plugin.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found