Facebook conversion tracking values for predetermined events - facebook

Can the {value: '0.00'} parameter be used with all 9 predetermined Facebook events for conversion tracking? For example, I am trying to say that a Search is worth 2.30. This is not a monetary value however, so I was leaving out the currency. Will this show up in Facebook's system?
<!-- 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','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '924082587688070');
fbq('track', "PageView");
fbq('track', 'Search', {value: '2.30'});
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=924082587688070&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->

As far as I have read, this is valid for all the facebook standard events. If you do not supply a currency I am pretty sure facebook will use the currency you have registered for you account.

Related

Facebook Instant Article(FBIA)’s ia_document object (for analytics) and its properties in detail?

I'm trying to track google analytics data for Author in Facebook Instant Articles (FBIA). Please see the comment in the example given below:
<item>
<title>
Article's Title
</title>
<description>Article's description</description>
<link>http://www.example.com/7216240</link>
<guid>7216240</guid>
<pubDate>Mon, 28 Aug 2017 10:31:50 +0200</pubDate>
<author>Author Name</author> // <-- This is the tag that I want to track in analytics
<content:encoded>
<![CDATA[
<!doctype html> <html lang="en" prefix="op: http://media.facebook.com/op#"> <head> ... </head> <body> <article>
...
</article> </body> </html>
]]>
</content:encoded>
</item>
According to facebook for developers' documentation on Analytics for Instant Articles:
Facebook also exposes a defined set of Instant Article data, which the
analytics trackers can use optionally. For JavaScript tracking codes,
that data is available in the ia_document JavaScript object.
<figure class="op-tracker">
<iframe>
<script>
// The URL the user shared
var urlSharedByUser = ia_document.shareURL;
// The article title
var title = ia_document.title;
// Referrer is always set to 'ia.facebook.com'
var referrer = ia_document.referrer;
</script>
</iframe>
</figure>
However, it doesn't describe in detail which properties are inside the ia_document object.
A few Q&A on SO explain only with limited examples, something like
<figure class="op-tracker">
<iframe>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-X', 'auto');
ga('require', 'displayfeatures');
ga('set', 'campaignSource', 'Facebook');
ga('set', 'campaignMedium', 'Social Instant Article');
ga('set', 'title', ia_document.title);
ga('set', 'referrer', ia_document.referrer);
ga('send', 'pageview');
</script>
</iframe>
</figure>
Is there any article that explains Facebook Instant Article(FBIA)’s ia_document object (for analytics) and its properties in detail?
What else do we have other than ia_document.title, ia_document.shareURL and ia_document.referrer? in my case, do we have ia_document.author?
Just figured out that there's a browser debugging tool which provides an approximation of the Instant Articles environment. So let me just answer my own question. The URL for the browser debugging tools is as below:
www.ia-tracker.fbsbx.com/instant_article_test?url=<share-url>
After testing it in a browser console, I can conclude that there are only 3 properties that belong to ia_document, which are ia_document.title, ia_document.shareURL and ia_document.referrer.
See the screenshot below:

Facebook Pixel Tracking Installation in Magento 1.9

I have been trying to implement the new Facebook Tracking Pixel to track conversion in a Magento store.
I have the base pixel code in the head tags
<!-- 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','//connect.facebook.net/en_US/fbevents.js');
fbq('init', 'PIXELID');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=PIXELID&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
I have then found the success.phtml file within the themes directories as added the following code as per my understanding when reading the Facebook documentation I have found;
<?php
//Get Order Number & Order Total
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
$amount = number_format($order->getGrandTotal(),2);
?>
<script>
// Purchase
// Track purchases or checkout flow completions (ex. landing on "Thank You" or confirmation page)
fbq('track', 'Purchase', {'value': '<?php echo $amount; ?>', 'currency': 'GBP'});
</script>
<noscript>
<img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id=PIXELID&ev=Purchase&cd[value]=<?php echo $amount; ?>&cd[currency]=GBP&noscript=1"/>
</noscript>
The above code isn't sending any data at all upon placing an order via a Facebook ad click. Can anyone shed any light as to what I am doing wrong?

New facebook conversion pixel on one page site (exclude audience)

complicated situation, i'll try to be as clear as possible.
I have a one page site with a contact form, index.html.
The page has the following remarketing facebook pixel:
<!-- 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','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '123456789');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=123456789&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
When a user submit the form, and i get a response from the ajax, I load an external html file to an iframe on my page (conv.html).
that external html file has a conversion code in it:
<!-- 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','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '123456789');
fbq('track', "PageView");
fbq('track', 'Lead');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=123456789&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
which is basically the same, only with a 'Lead' track event.
as you can see im using 'PageView' on both pixels in order to exclude by the url audience who has submited the form (i need that in addition to the lead event), the thing is, that when i load the second pixel, i get an error saying that the pixel was fired more than once.
im not sure if that any matters, but we have also applied a rule to the second pixel to fire only on page url that contains 'conv.html' (the page that is loaded to my iframe).
i have been look around on google for a solution, but couldnt find anything.
im trying to figure out if thats even possible on a one page site.
any ideas?

Facebook share button is scraping a different page's info

I have this code for a Facebook custom share button:
<script>
function fbs_click() {
u=location.href;
t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}
</script>
<a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" onclick="return fbs_click()" target="_blank" class="fb_share_link">
<img src="../../../../../image/photography/pics/fb-share.png" alt="Share this!" width="57" height="21" border="0">
</a>
This is supposed to scrape info from the page but for some reason it doesn't and it gets redirected to the site's main index.html.
I've tried adding facebook og tags and the extra code in the but to no avail.
Any thoughts?
EDIT: Having been told that the share function has been deprecated, I tried to do this with the feed dialog:
<a href="https://www.facebook.com/dialog/feed?link=http://www.travel2italy.com/Travel/Italy/Company/photography/index.html&picture=http://www.travel2italy.com/image/photography/pics/homepage/florence1-home.jpg&name=travel2italy.com&caption=Photo%20Gallery&description=A%20Beautiful%20photo%20of%20Florence&redirect_uri=http://www.travelive.com" target="_blank">
<img src="../../../../../image/photography/pics/fb-share.png" alt="Tweet this!" width="57" height="21" border="0">
</a>
but when i click on the link it takes me to facebook and says an error occured, wth?!:(
EDIT 2:
I wasn't aware that the app_id argument is needed, signed up for an app and it works now, but it strips away the #section I have at the end of the link (i want it to link to a specific slide in a slideshow)
EDIT 3:
Now some of the share buttons using the sharer do seem to work but don't pull all the photos off the page for me to choose the one i want, this is insane-o, could it just be a caching issue?

Facebook, iframe app, fb:request-form, action attribute problem

I'm making a facebook iframe application
I'm making a request form with my own form data. What should I do in order to process the data?
If I put action="http://apps.facebook.com/[appName]/abc.php" , i.e.
<fb:serverfbml>
<script type="text/fbml">
<fb:fbml>
<fb:request-form action="http://apps.facebook.com/[appName]/abc.php" method="post" type="abc" content="abc">
<textarea name="pm" fb_protected="true" ></textarea>
<fb:multi-friend-selector showborder="false" max="35" actiontext="test" email_invite="true" bypass="cancel" />
</fb:request-form>
</fb:fbml>
</script>
</fb:serverfbml>
Then the result is funny... A facebook page inside the facebook app's iframe !
but if I put action="http://[my own domain / facebook connect url]/abc.php" , i.e.
<fb:serverfbml>
<script type="text/fbml">
<fb:fbml>
<fb:request-form action="http://[my own domain / facebook connect url]/abc.php" method="post" type="abc" content="abc">
<textarea name="pm" fb_protected="true" ></textarea>
<fb:multi-friend-selector showborder="false" max="35" actiontext="test" email_invite="true" bypass="cancel" />
</fb:request-form>
</fb:fbml>
</script>
</fb:serverfbml>
Then the result page will be rendered WITHOUT facebook template (that means losing all top facebook banner and bottom facebook bar like the facebook chats etc)
Anyone knows what's wrong?
Thanks a lot for reading
The key to the target="_top" is that you have to place it on both the request form and the multi-friend-selector in order for it to work on submit and cancel, respectively.
The request-form needs target="_top" so that the form will load in the top frame when submitted, but the cancel functionality is controlled by the multi-friend-selector, not the request-form. Ergo, you need target="_top" on the multi-friend-selector as well so that the cancel action will load in the top frame.
Now, I just wish Facebook would allow a "none" action for cancel that would just hide the frame...
NEW Answer:
Facebook has started phasing out FBML and is strongly encouraging developers to switch to Requests 2.0. Using the new FB.ui({method:'apprequest',...}); in the JavaScript SDK is an easier way to do this. It also supports off-Facebook pages http://af-design.com/blog/2011/02/17/using-facebook-requests-to-promote-a-website/
OLD Answer:
I found that passing the FBML as an attribute for fb:serverfbml worked.
<fb:serverfbml fbml=" {HTML Escaped FBML Here} " ></fb:serverfbml>
I posted about my findings here: http://af-design.com/blog/2010/11/23/fbserverfbml-on-canvas-iframe/
The way I handled this was to have my form processor page emit no output except an "< fb:redirect >" that pointed back to the main app.
How did you use this < fb:redirect > ?
ok I found it try adding target="_top"
http://apps.facebook.com/myapp' label='Join Now' />"
action="http://apps.facebook.com/myapp"
target="_top"
invite="true">