void pageHead(string Content)
The pageHead()
function writes content to the head (<head>
) of the HTML output. This can be used, for example, on the first page of the questionnaire Open Graph Markup can be deposited to control the preview in Facebook.
Warning: Faulty XML/HTML code can cause the questionnaire page to be displayed incorrectly or not at all.
Note: If you want to add the same content to all pages of the questionnaire, you can also write it directly into the HTML template of the questionnaire layout.
Note: Preferably, use the library()
function to load JavaScript libraries.
If you want to define with which short text and image (thumbnail) the questionnaire is displayed in a Facebook post, you would place the following PHP code for this on the first page of the questionnaire:
pageHead(' <meta property="og:url" content="https://www.soscisurvey.de/MEIN-PROJEKT/" /> <meta property="og:image" content="https://www.soscisurvey.de/MEIN-PROJEKT/fb-image.jpg" /> <meta property="og:title" content="Fragebogen zum Mediennutzungsverhalten" /> <meta property="og:description" content="Media usage behavior is incredibly varied and individual. Take part in this incredibly exciting questionnaire!" /> ');
If this does not work, it can have several causes:
The easiest way to fix these problems is with a tool from Facebook, the Sharing Debugger. There you enter the link to the questionnaire and then click on “Troubleshooting”. If an outdated version is displayed, you can tell Facebook to rescan the page by clicking “Rescan”.
A quick description of the data:
<meta property=“og:url” content=“[URL]” />
<meta property=“og:title” content=“[Titel]” />
<meta property=“og:image” content=“[URL]” />
<meta property=“og:description” content=“[Info]” />
<meta property=“og:type” content=“[Typ]” />
website
) is relevant if you want, for example, the display for videos or news articles … but false information here can lead to blocking on Facebook. Possible types are described in the The Open Graph protocol.<meta property=“fb:app_id” content=“[ID]” />