How to send custom events to Facebook Pixel using Zapier - facebook

I would like to send custom event data into my Facebook pixel whenever a lead is processed through one of my zaps.
Since some of my leads come through messages there isn't a good way to track this information in the pixel.
I was hoping to use the code by Zapier tool to trigger the Facebook pixel script along with event tracking parameters. When I go to set this up though it doesn't work. Can you provide me any help on how I can get a zap to ping the FB pixel?
All I've tried so far is just pasting the pixel and event parameters into the code block. My expertise does not go beyond this lol. I have removed my pixel ID from the code below.
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'PIXEL');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=PIXEL&ev=PageView&noscript=1"
/></noscript>
<script>
fbq('track', 'CompleteRegistration');
</script>

David here, from the Zapier Platform team.
First off, just dropping that code block into a Code step won't work since it is html code (that runs JS in the browser window). Code steps are Node.js, which is mostly similar but different enough that this isn't going to work.
You'll have less control, but I think what will work is doing a GET request (using a webhooks action) to https://www.facebook.com/tr?id=PIXEL&ev=PageView&noscript=1, which is what happens when javascript has been disabled. I'm not sure what exactly gets tracked, but it'll be better than nothing.
That said, this seems like a great use case and it's probably worth writing into contact # zapier . com to request this as a feature. It's likely others have also wanted this and/or there's a workaround I'm not aware of.

Related

Facebook pixel causes strange text behaviour

Whenever I add the following code to a page of my website (https://traineeshipondernemen.nl/blog), some special characters start to misbehave. Ik have added two screen shots below to illustrate the problem.
The website is build with Bootstrap (4.3.1). Only html, css and Javascript.
Strange enough, the problem only occurs when I upload the file to the servers. When I run the site on my computer (local) everything looks fine.
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window,document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '376622943264914');
fbq('track', 'PageView');
</script>
<noscript>
<img height="1" width="1"
src="https://www.facebook.com/tr?id=376622943264914&ev=PageView
&noscript=1"/>
</noscript>
Page without Facebook Pixel
Page with Facebook Pixel - textual changes are highlighted
This is the solution. Thanks CBroe!
Some sort of problem with character encoding, characters in UTF-8 getting interpreted as something else. validator.w3.org/nu/… lists “The character encoding was not declared. Proceeding using windows-1252” as first error. You have in there, but it comes after the tracking pixel codes - try and put it before, and see if that changes things.

facebook login button - there are two samples on the facebook site

I'm reading this documentation:
https://developers.facebook.com/docs/facebook-login/web/
sadly the documentation is confusing. The page has a code-generated button, which is very nice. However, the actual code the page uses is completely different -
<fb:login-button scope="public_profile,email" onlogin="checkLoginState();">
I don't understand which one I'm meant to use, or how to call a js method on logging in if I use the code generated sample:
<div class="fb-login-button" data-max-rows="1" data-size="xlarge" data-show-faces="false" data-auto-logout-link="false"></div>
The code sample calls "onlogin", but it is some sort of weird... facebook thing. Has anyone done login (and, honestly, with facebook's money you'd think they could write documentation! grrr!)
They should both work, they are just different versions of writing the same thing. The latter is the HTML5 compatible version.
And the onlogin attribute works for both; it doesn’t even have to be written as data-onlogin as the rest of the parameters in the HTML5 version. I’m pretty sure Facebook parses that attribute itself (browsers don’t know a native login event), but guess they simply chose that attribute name to have it be kind of consistent with “traditional” HTML event handler attributes such as onclick etc.

Facebook "like" button on comments

Is it possible to implement the Facebook like and share functionality for "liking" the comments of other users on a website? Does every comment has to have a permalink?
I have asked the question on Facebook developers forum, and they have come back to me with this response. Basically, the functionality that is required is not available.
http://forum.developers.facebook.net/viewtopic.php?pid=316205#p316205
Intro:
You will need individual like buttons for every comment, and as #Fnatte says you can then reference them to the comment by giving it an ID like #com1,#com2etc...
The best way to achieve this is through a for loop (I imagine you are pulling from a DB) that will iterate through and add the relevant code for the like button and implement the URL based on the comment it is pulling,
The Code:
You have 2 options, <iframe>:
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fexample.com%2Fpage%2Fto%2Flike&layout=button_count&show_faces=false&width=90&action=like&font=segoe+ui&colorscheme=dark&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;" allowTransparency="true"></iframe>
This is VERY slow, especially if you have a lot of comments loading at the same time, it does mean you don't need to import their JS library though,
Then there is the FB JS SDK:
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http://example.com" layout="button_count" show_faces="false" width="90" font="segoe ui" colorscheme="dark"></fb:like>
This I would argue is a more eficcient way of doing things, but it does require a bit more time and effort - but will be well worth it.
The script of course can be imported only once in the head and then used multiple times throughout the page (perfect for what you need).
The URL to like is based on both the URL in the address bar and the ID that you have assigned to the code (e.g. #comment1) so the URL you are liking looks like this: http://mypage.com/page#comment1
Further Reading:
http://developers.facebook.com/docs/reference/plugins/like/
http://developers.facebook.com/docs/reference/javascript/
http://developers.facebook.com/docs/plugins/
Good luck and I hope this helps!
DEMO & SOURCE http://so.devilmaycode.it/facebook-like-button-on-comments/
updated, hope this help
I have never done it myself but you should probably check out http://developers.facebook.com/docs/guides/web#plugins.
It looks like you would need a unique link for each comment.
You could try including a fragment identifier in every URL like:
http://domain.com/article1#comment1
http://domain.com/article1#comment2
Facebook has rolled out a new version of the comments plugin which supports advanced functionality such as "liking" and replying to other comments. In addition, replies to a comment made on Facebook.com are now pushed back to the comments plugin (hosted on another site.)
How to enable:
Add the migrated attribute:
<fb:comments xid="YOUR_XID" migrated="1"></fb:comments>
OR use the href attribute instead of xid for future comments boxes
<fb:comments href="YOUR_CANONICAL_URL"></fb:comments>
References:
New <fb:comments>
Legacy <fb:comments>

Is it possible to put an iframe inside a Facebook page tab?

According to the Facebook developer roadmap, it will soon be possible to put iframes inside page tabs but it's not yet available. I came across this Store Locator on Coach page which uses an iframe to display a Google map inside a tab :
http://www.facebook.com/Coach?v=app_168904438199&ref=ts
Looking at the source code, I see the map really is inside an iframe. How is this possible?
in STATIC FBML pages you CAN'T USE IFRAMES - no matter what FBML code you put in there, facebook have specifically made the code not work in in business page/tab static fbml pages - my guess is so they can prevent people setting up Amazon stores or other content that uses IFrame (spammers and spyware often use iframes) - the updates are in their 2010 wiki - so it's probabley also a security thing.
I frames can still be used on developers canvas pages apparently but the customer has to click on an image for it to activate rather than the iframe automatically loading - again this is probably a security issue to prevent driveby downloads - where zwinky and similar toolbars are forced onto people computers in the background via iframes without their knowledge.
However some say it does work although you need a user to click on it before it works. if you can live with that then go for it.
<a onClick="outside_location.setInnerFBML(location_two);" style="cursor: pointer;"><center>→our website</center></a><div id="outside_location"> <fb:iframe width="730" height="400" frameborder="0" src="http://www.fborder.com/" /> </div>
<fb:js-string var="location_two"> <fb:iframe width="730" height="600" frameborder='0' src='http://www.fborder.com/' /> </fb:js-string> <script type="text/javascript" charset="utf-8"> var outside_location = document.getElementById('outside_location'); </script>
check out this post. people have got it to work. and some say it wont work for the obvious reasons. such as security and so on. but give it a go regardless.
http://www.facebook.com/topic.php?uid=4949752878&topic=7081
PK

Facebook Request Form's Skip button doesn't work

The fbml below generates an invite form using a multi-friend-selector. Everything works, except the Skip button. No matter what url I place in the action attribute, the action in the rendered form is always blank. This of course causes the Skip button to 404.
<div class="invite">
<fb:serverFbml width="626">
<script type="text/fbml">
<fb:request-form
action="default.asp"
target="_top"
method="POST"
invite="true"
type="My Application"
content="<fb:req-choice url='facebook.com/somepage' label='Authorize my Application'/>">
<fb:multi-friend-selector showborder="true" email_invite="false" cols="4" rows="1" actiontext="Invite your friends to use My Application!">
</fb:multi-friend-selector>
</fb:request-form>
</script>
</fb:serverFbml>
</div>
Edit: On closer inspection, it looks like the 404 it goes to is http://www.facebook.com/plugins/serverfbml.php?. Found this as the only 404 response when tracking in Fiddler.
had the same problem and it was driving me crazy but i managed to fix it.
Try this : <fb:req-choice url='facebook.com/somepage' '
just add another ' right after that, make sure you use space between them. It's funny how I spent 2 hours trying to figure that out. If you wish I'll just copy and paste the whole code. Hope this helps, I'm pretty sure it will since I had the exact same issue. Cheers.
I had the same issue!!!
The fix was the following in my case:
action="http://YOURDOMAINNAME/APP/welcome.htm?${query_string}"
YOURDOMAINNAME must be the same as in your Canvas URL!
Update
Official response from Facebook on my bug report; they've closed it. Only took five months :).
Thanks for the report.
As we are in the process of
deprecating FBML/FBJS, we will not be
adding additional features or fixing
current bugs. If you are creating an
application on facebook.com, please
implement your application using our
supported APIs, SDKs and Social
Plugins. Using these you can embed
many of the same social features
available in FBML.
Please see more at our roadmap:
http://developers.facebook.com/roadmap