We have integrated AMP analytics script with amp-iframe tag. We can't able to use the amp-analytics tag for various reasons. We need an AMP HTML's referrer information in the iframe for identifying the source of traffic to the AMP page. The amp-iframe src will point to our domain/subdomain. When the AMP page loaded from Google CDN it will be in the different domain. Is there any way to get the referrer of the AMP HTML within amp-iframe HTML?
Please find the example AMP HTML structure
<!doctype html>
<html amp>
<head>
<meta charset="utf-8">
<title>Title of the AMP HTML</title>
<link rel="canonical" href="https://www.example1.com/example-content" />
<script custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js" async></script>
<script src="https://cdn.ampproject.org/v0.js" async></script>
</head>
<body>
<amp-iframe class="amp-analytics" width="1" height="1" sandbox="allow-scripts allow-same-origin" frameborder="0" layout="fixed" src="https://iframe.example.com/amp-analytics?query1=value1&query2=value2">
<amp-img src="https://www.example.com/inc/amp/placeholder.png" height="1" width="1" layout="fill" placeholder></amp-img>
</amp-iframe>
<div>Content</div>
</body>
</html>
I am trying to get the referrer information of the AMP HTML inside the iframe https://iframe.example.com/amp-analytics
.
Thank you in advance.