Card of page that do a redirect


#1

Hi. I have a campaign URL like http://foo.com/campaign/black-friday/a42bh32h42h342h3. In server-side I identify the campaign (black-friday, in this case), find its details using the token (a42bh32h42h342h3) and, based on all infos, I redirect the user to an proper page.

My intention is to have card for my campaigns. But the crawler don’t get the metatags - because of the redirect, I guess.

The crawler access the URL via GET or another HTTP verb? There’s a way to do the crawler don’t follow the redirect? I already tried remove the redirection instruction from server-side and respond with a page only with metatags and a javascript to do the redirect.


#2

If this is a HTTP redirect, are the meta tags available in the resulting page?

If so, please check if your robots.txt file is allowing Twitterbot user agent, as explained here: https://dev.twitter.com/cards/troubleshooting#staging

Crawler will stop when it finds the meta tags. Do you have a running example? It will be more easy to debug.


#3

The meta tags are available in the page that has the JS script that do the redirect using window.location.href. We are trying this because the meta tags on request headers didn’t work.

User access the page => server renders a page with JS that redirects user to the resulting page.
Twitter bot access the page => server renders a page with proper meta tags and a JS that redirects to the resulting page

Our first try:

User access the page => server redirects user to the resulting page.
Twitter bot access the page => server add meta tags to response headers and redirects to resulting page.

Try this: https://www.fantasy.ninja/mgm/rewards_network/bbd55785829cb120e100a9d8d8877c02


#4

I just realize that this URL requires authentication. This might be the problem. The bot is redirected to sign in page, I guess.

Until we make this page public, we will put meta tags in sign in page.


#5

This definitely can be the case. A good test is to use a terminal HTTP client and change the User Agent to Twitterbot just to see what happens. Glad you found the issue.

I recommend you to at least validate the Card for the domain with fake information, then when you publish the website the Card is already available.