amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-story-social-share Not working

Open abhiz10 opened this issue 5 years ago • 11 comments

Description

@mszylkowski Is this feature Live ? Because I have Implemented this locally, I'm passing the old bookend.json in which the share provider is present. But locally it's not showing any share provider at the end of the story. I also provide a demo file in the attachment below. Is my Implementation is correct? Please help. Thank You

Reproduction Steps

social-share.zip

Relevant Logs

No response

Browser(s) Affected

Chrome

AMP Version Affected

Latest

abhiz10 avatar May 25 '21 10:05 abhiz10

Hi! Seems like the server has an internal error when fetching the bookend.json with the parameters passed by AMP. Make sure that the server succeeds when sending the request. Also, with a properly configured social-share, the share providers will be shown properly when clicking on the share icon on the story, but it should not trigger the share dialog automatically when reaching the end. For that purpose, you can configure amp-story-player events and render your own UI on top of the player.

This is the request my browser made to the server, which is returning the 500 error (Internal server error):

curl 'https://travel.visualstories.com/quizzes/is-your-knowledge-of-greenland-evergreen/bookend.json?__amp_source_origin=file%3A%2F%2F' \
  -H 'Connection: keep-alive' \
  -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"' \
  -H 'Accept: application/json' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36' \
  -H 'Origin: null' \
  -H 'Sec-Fetch-Site: cross-site' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Accept-Language: en-US,en;q=0.9,es-UY;q=0.8,es;q=0.7' \
  --compressed

mszylkowski avatar May 25 '21 13:05 mszylkowski

@mszylkowski Thank you so much for the help.

abhiz10 avatar May 25 '21 15:05 abhiz10

@mszylkowski Will this JSON work? https://testweb.visualstories.com/test-auto-advance-release/bookend.json?utm_source=visualstories.com

{"bookendVersion":"v1.0","shareProviders":[{"provider":"facebook","app_id":"56756756756"},"twitter","pinterest","linkedin","tumblr","whatsapp","email","sms"]}

The existing JSON was https://testweb.visualstories.com/test-auto-advance-release/bookend.json which includes all the data regarding related stories and credit text and credit URL's

abhiz10 avatar Jun 07 '21 08:06 abhiz10

Yes, both JSONs should work. You can tell if a JSON would work if you add it to the story inline like so:

<amp-story-social-share>
    <script type="application/json">
      {
        "bookendVersion":"v1.0",
        "shareProviders":[{"provider":"facebook","app_id":"56756756756"},"twitter","pinterest","linkedin","tumblr","whatsapp","email","sms"]
      }
    </script>
</amp-story-social-share>

The problem seems to be that when you make the HTTP request to your server, it returns 500 - Internal Server Error at least when I tested that URL on a test story I made (it works when I open the URL on the browser directly though). If you check on the Network tab of your browser, the request should succeed in order to retrieve the config.

image

mszylkowski avatar Jun 07 '21 14:06 mszylkowski

@mszylkowski Thank you so much. I will check the inline part at my end and also solve the 500 - Internal Server Error issue.

abhiz10 avatar Jun 07 '21 14:06 abhiz10

Hi... @mszylkowski

  • I have changed the code as to said ~ https://testweb.visualstories.com/test-auto-advance-release
  • It's showing an AMP Error "The mandatory attribute 'layout' is missing in tag 'amp-story-social-share'"
  • So, I added layout="nodisplay" ~ https://vs-subdomain-appsites.azurewebsites.net//testweb.visualstories.com/test-auto-advance-release
  • Now the AMP Error issue is solved.
  • Is this the correct implementation?

abhiz10 avatar Jun 13 '21 10:06 abhiz10

Yes! I can see all the share providers when clicking on the share icon, so seems like the configuration is working

mszylkowski avatar Jun 14 '21 23:06 mszylkowski

@mszylkowski Great, Can you share the screenshot of share icon ?

abhiz10 avatar Jun 15 '21 21:06 abhiz10

image => image

mszylkowski avatar Jun 15 '21 21:06 mszylkowski

@mszylkowski Thank you so much for your support. So I'll be adding layout in my final release.

abhiz10 avatar Jun 15 '21 21:06 abhiz10

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 24 '22 10:12 stale[bot]