Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

${documentReferrer} is empty when document.referrer is “https://www.google.com/” #10374

Closed
mattrohland opened this issue Jul 12, 2017 · 4 comments

Comments

@mattrohland
Copy link

Looking through the AMP documentation (https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md#document-referrer) is appears that the ${documentReferrer} variable should reflect the JS document.referrer.

While ${documentReferrer} appears to return the correct value for other domains (like: www.twitter.com, t.co, linkedin.com, etc.) when the page's document.referrer value is "https://www.google.com/" ${documentReferrer} is empty.

I couldn't find any documentation indicating that the www.google.com domain carried any additional caveats. Is this a bug or expected behavior?


For some context, this behavior was observed after implementing the "adobeanalytics_nativeConfig" approach provided by Adobe: https://marketing.adobe.com/resources/help/en_US/sc/implement/accelerated-mobile-pages.html

@cramforce
Copy link
Member

cramforce commented Jul 12, 2017

To @lannka while @zhouyx is out.

This is certainly not intended.

@lannka
Copy link
Contributor

lannka commented Jul 12, 2017

@mattrohland do you have a page that we can reproduce the issue?

@mattrohland
Copy link
Author

mattrohland commented Jul 13, 2017

It turns out that the documentation provided by Adobe was not followed precisely in our implementation (https://marketing.adobe.com/resources/help/en_US/sc/implement/accelerated-mobile-pages.html).

Stripping out a lot of the noise, the following code was in use in our implementation:

<amp-analytics type="adobeanalytics_nativeConfig">
    <script type="application/json">
        {
            "requests": {
                "base": "https://${host}",
                "iframeMessage": "${base}/amp/iframe.html?page-referrer=${documentReferrer}"
            },
            "vars": {
                "host": "www.example.com",
                "documentReferrer" : "{{meta.Referer}}"
            },
            "extraUrlParams": {}
        }
    </script>
</amp-analytics>

Inclusion of the vars.documentReferrer entry deviated from Adobe's documentation and appears to be the culprit. Once that extra value was removed referrals for "https://www.google.com/" started to work correctly.

"vars": {
-     "host": "www.example.com",
-     "documentReferrer" : "{{meta.Referer}}"
+     "host": "www.example.com"
},
"extraUrlParams": {

This was an implementation issue on our end not a bug in AMP.

@lannka
Copy link
Contributor

lannka commented Jul 13, 2017

@mattrohland since you get that far, it will be appreciated if you could file a bug against adobe folks :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants