If we try to add it via "Add Javascript" we always get the following error message:
SiteWide.Alert
Invalid JavaScript! You cannot save until you fix all errors: Unexpected token <
What can we do to make this work?
Thank you!
Page 1 / 1
If I were you I would take the initial function and drop it in the header between html script tags like so:
```
<script>
!function ....
all the way until
fbq('init', 'ID');
</script>
```
I would then put the pageView tracker or any other custom conversions you want in the Add Javascript section, like so
```
/* Add JavaScript Below This Line */
fbq('track', 'PageView');
```
Hi! I'm wondering if anyone has successfully embedded a pixel in this way. I've been trying (including variations on the suggestion above) and I'm still getting the sam error (Invalid JavaScript! You cannot save until you fix all errors: Unexpected token < ). I've been putting it in the first question on the survey, although facebook says to put it in a header, because when I try to put it in the header, the javascript shows up as though I had just typed in a header (so when someone takes the survey, they see the code!) I'm not a developer, we're just a small research company so I'm trying to troubleshoot this on my own. If anyone knows how to do this, I'd love to learn!
> Hi! I'm wondering if anyone has successfully embedded a pixel in this way. I've been trying (including variations on the suggestion above) and I'm still getting the sam error (Invalid JavaScript! You cannot save until you fix all errors: Unexpected token < ). I've been putting it in the first question on the survey, although facebook says to put it in a header, because when I try to put it in the header, the javascript shows up as though I had just typed in a header (so when someone takes the survey, they see the code!) I'm not a developer, we're just a small research company so I'm trying to troubleshoot this on my own. If anyone knows how to do this, I'd love to learn!
You can't add HTML to the JavaScript editor, which is probably why you are getting that error.
You can either remove the script tags `<script>` and `</script>` or add all that to the Header section of the Look and Feel.
So, has anyone managed to implement Facebook Pixel in this way? I haven't seen yet any success stories.
Hi, yes we implemented the pixel using this way.
Under 'Look & Feel' open the Header section and go to the HTML editor.
I dropped the standard pixel code Facebook supplied and, according to the Pixel Helper extension for Chrome, it's all firing fine.
https://www.qualtrics.com/community/discussion/comment/18720#Comment_18720Hi Marty, Is everything still working for you? I tried to drop the FB pixel into the header under look and feel and I get an error in the chrome extension: "We detected event code but the pixel has not activated for this event, so no information was sent to Facebook. This could be due to an error in the code, but could also occur if the pixel fires on a dynamic event such as a button click." has anyone else encountered this problem?
Problem has been solved and it is the classic case of curly braces:
you need to remove the curly braces around {your-pixel-id-goes-here} - so it should be just your id surrounded by quotes - and remember to do that in the script tag as well as the image url
Hi, I have added the Facebook pixel code in the header section but still doesn't seem to be displaying. This is the code - any suggestions (I am not code-literate)? Thank you
Hi,
We had no issue for a long time with implementing the pixel onto Qualtrics. As most people recommended, we put it into the "source" button in Look & Feel - Header.
The code does not show up as text, which is good new. And when we sign out and sign back in we are still able to find the code.
The issue now is that whenever we try to set up events and put in the website URL, we receive the message shown in the attached screenshot. Thanks,
Dana
Hi,
Firstly, thank you to the contributors in this thread. Adding the code to the header works to link Facebook ads with Qualtrics, and Facebook is able to track visits to the first page. However, I also want to ensure that Facebook ads mostly appear to people who are more likely to complete the survey. Therefore, I tried to add a JavaScript code to the last page of the survey. It did not work; Facebook cannot find the pixel, as Dana reported above. How can we reconfigure Facebook ads better to detect a pixel aimed at understanding if a participant sees the last page of the survey? Research completion is the best measurement of conversion for the researchers.