LinkedIn Ads conversion tracking Sleeknote forms - forms

Im an intern and has been granted the privilige of setting up connversion tracking, so we can track who that has been signing up to our newsletter after they clicked one of our LinkedIn Ads. But i have some trouble making it work.
So far, we have integrated the LinkedIn insight Tag in the footer of the website, so it will be able to track conversions. The Insight tag source status is Active, so that’s all good.
Furthermore, we have set up the conversions we want to track and used the ‘Event-Specific’ method. To track when someone is submitting a form, in this case our newsletter sign-up form, I’ve pasted the code below to the header of our website. Then it should be triggered when someone submits the form. The var id is the campaign id for the newsletter signup in Sleeknote. "Your code here" == LinkedIn event-specific snippet
<script type='text/javascript'>
document.addEventListener('sleekNote', function (e) {
var id = 'INSERT CAMPAIGN ID HERE';
if (e.data.type == 'submit' && e.data.campaignId == id)
{
"Your code here"
}
}, false);
</script>
I used this documentation: https://help.sleeknote.com/hc/en-us/articles/7005018805661-What-is-EventEmitter-
Does anyone have a suggestion of how i can make it work?
Thanks in advance!
I've tried reaching out to Sleeknote and LinkedIn

Related

Display something for people who like or not like our facebook page

I search a solution for the problem highlighted in this question.
Unfortunately, the accepted solution (which dates back to 21/11/2012) doesn't work anymore, as you can this in this demo.
Does someone know why?
Body
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : '179378788777832',
status : true,
cookie : true,
xfbml : true
});
</script>
<div id="login">
You are not logged in to FB, Please click here to login.
</div>
<div id="container_notlike">
YOU DONT LIKE
</div>
<div id="container_like">
YOU LIKE
</div>
JS
var hideLogin = function(){
$("#login").hide();
}
var showLogin = function(){
$("#login").show();
}
var doLogin = function(){
FB.login(function(response) {
if (response.session) {
hideLogin();
checkLike(response.session.uid)
} else {
// user is not logged in
}
});
}
var checkLike = function(user_id){
var page_id = "40796308305"; //coca cola
var fql_query = "SELECT uid FROM page_fan WHERE page_id = "+page_id+"and uid="+user_id;
var the_query = FB.Data.query(fql_query);
the_query.wait(function(rows) {
if (rows.length == 1 && rows[0].uid == user_id) {
$("#container_like").show();
//here you could also do some ajax and get the content for a "liker" instead of simply showing a hidden div in the page.
} else {
$("#container_notlike").show();
//and here you could get the content for a non liker in ajax...
}
});
}
$(document).ready(function(){
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
hideLogin();
checkLike(response.authResponse.userID)
} else {
showLogin();
}
});
$("#login a").click(doLogin);
});
CSS
body {
width:520px;
margin:0; padding:0; border:0;
font-family: verdana;
background:url(repeat.png) repeat;
margin-bottom:10px;
}
p, h1 {width:450px; margin-left:50px; color:#FFF;}
p {font-size:11px;}
#container_notlike, #container_like, #login {
display:none
}
I search solution for hours but I didn't find anything what works.
Thank you for help.
Like Gating is not allowed anymore, that´s why it is not possible. The only reliable way to get that information is by authorizing a user with the user_likes permission and using /me/likes/[page-id]. But you will not get that permission approved for like gating in the Login Review.
People need to like something because they really want to, not because they get something for it:
Only incentivize a person to log into your app, enter a promotion on your app’s Page, or check-in at a place. Don’t incentivize other actions
Source: https://developers.facebook.com/policy/
Btw, you can also subscribe to the edge.create event to find out if a user just clicked your like button, but you can´t find out if the user liked it before: https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/
The problem on that code is that FQL is deprecated .
You can't do what you want to, and thats why changes are necessary .
Your code would work if your app is old, created before changes that turns like gating not allowed, but anyway, you cannot use that for show content. You can use that kind of implementation for creating an interactive experience, where you can for example changing the content, saying "Thanks for liking".. Or "Connect with us, liking our page.." ..
You can also think about interfaces, where you show up the page plugin, and just after user likes, you say Thank you ... and hide the page plugin ... But user must always be able to close without liking .
For checking if user likes a page, you need use :
FB.api get on '/me/likes', and with the response ...
if (response.data[likes].name == "Coca-Cola")
or... better
if (response.data[likes].id == "40796308305") {
}
I repeat, One thing has nothing to do with another ..
You can check if user likes a page, but you cannot restrict content, based on this kind of resource .
There are other ways to check it, for exaple :
Get api call to userid/likes/pageid returns page info if user likes the page, and returns nothing if user does not like the page .
You will waste time trying do that for controlling content consumption .
Your app must be aprooved for asking user_likes permission, and its better you think about creating another experience for users, instead of submitting something like that .
I also think that content with good open graph for sharing, commenting and optional liking is very much more efetive, because i noticed that many people used to like and dislike the page after getting the content .
If you just... Prompt a FB.UI for sharing after 1 minute, for example, you will have much more results .. Aways positioning the page plugin in strategic places, people will naturally like your page ..
Than you can say change the page plugin element :
Thank you for liking, please share with your friends ....
Who would also like ...
Or use a callback for triggering the share dialog ..
OLD SCHOOL API CALL
The method FB.Event.subscribe() allowed apps to subscribe to a range of events, and define callback functions for when they fire, is deprecated .
Also FQL Query is deprecated .
For checking if user likes a page, you need user.likes permission, so you can try :
FB.api get on '/me/likes', and with the response ...
if (response.data[likes].name == "Coca-Cola")
or... better
if (response.data[likes].id == "40796308305") { }
There are other ways to check it, for exaple :
Get api call to userid/likes/pageid returns page info if user likes the page, and returns nothing if user does not like the page .
You can check if user likes a page using this call, but you cannot restrict content, based on this kind of resource .
2018 UPDATED SOLUTION
But nowadays, in 2018 the best method for is setting Webhooks .
Webhooks are a subscription based system between Facebook and your server. Your app subscribes to receive updates from Facebook via a specified HTTPS endpoint .
This allows your to app to receive notifications whenever there are updates to a chosen set of topics and their fields, so, you can track changes to most sections of the user's profile, such as About, Photos, Posts, Friends, and Likes.
Webhooks update notifications are sent as POST requests to a callback URL that you supply. Notifications can be lightweight, indicating only that a field has been updated, or can include the newly updated value .
webhooks user reference
Full list of user profile fields that you can subscribe to, such as About, Photos, Posts, Friends, and Likes.
webhooks page reference
The easiest way to set up your app to receive Webhooks updates is to use the App Dashboard's, check out Facebook Platform documentation for more info .
Webhooks documentation

getting notification when someone comments using comments plugin

So I have an iFrame app on a fan page, which includes the comments plugin. Is there a way I/any admin can receive a notification or email every time someone adds a comment?
You can subscribe to comment.create event and send the notification to admin in any way you prefer, once comment is created. Facebook itself doesn't provide such functionality.
This may looks like this (I assume Facebook JavaScript SDK is already loaded on page before doing this, read about it in documentation on Loading, anyway if you're using Social Comments Plugin it should be loaded already):
<script type="text/javascript">
FB.subscribe('comment.create', function(response){
// Here you need to do a call to some service/script/application
// to notify your administrator about new comment.
// I'll use jQuery ajax to call server-side script to illustrate the flow
$.post('//hostnamne/path/to/script', {
"action": "comment created",
"url_of_page_comment_leaved_on": response.href,
"id_of_comment_object": response.commentID
});
});
</script>
In your script located at http(s?)://hostnamne/path/to/script you can send a notification to admin, how to do it may vary on way you want it for example if you want to send an email you can use something like this php sample (aging this is just a flow sample, not real code you should use):
<?
$admin_email = 'root#localhost';
$commentID = $_REQUEST['id_of_comment_object'];
$page_href = $_REQUEST['url_of_page_comment_leaved_on'];
$message = "comment #{$commentID} was leaved on page {$page_href}";
mail($admin_email, "You have a new comment", $message);
?>
If you need to track the deletion of comments too you can use comment.remove event with similar flow...

How to get ids of facebook invited friends by user in my asp.net4.0 web application

I am developing an ASP.NET application. I implemented Facebook JavaScript API in my application, for connect with Facebook and get FB friend list of user. I had done this successfully.
Now, I want to count how many friends are invited by user. Is it possible with facebook API. User can select multiple friends and i want to count how many friends selected and invited by user, Invited friends Id is bonus if We can get.
Please don't forget that facebook changed its Oauth settings for security reasons.
I'm also trying to get ids values after Send Invitation button clicked and page post back to
if (Request.Form["ids"] != null)
{
span1.InnerHtml = "ids";
//put success code here..
}
else
{
span1.InnerHtml = "oops no id";
}
if (Page.PreviousPage != null)
{
span1.InnerHtml = "ids";
//put success code here..
}
else
{
span1.InnerHtml = "oops no id";
}
but in this case program control always goes to else condition it means after page is post back form return null value.
Is there any way to get ids of invited friends.
Thanks.
If you using Facebook Requests to send invites (you really should, it's intended for this), the only way to get invited friends is via Facebook Requests Dialog callback:
FB.ui({method: 'apprequests', message: 'Whoa!'}, callback);
function callback(response){
// response.to now contain array of invited users ids
console.log('Invited friends ids', response.to);
if (response.request) {
console.log('Efficient Request id', response.request);
} else {
console.log('Requests Ids', response.request_ids);
}
}
There is no way to get request sent by user via Graph API or FQL, you only can get requests received by user. You may save all requests sent by your users and rely on this data if you need aggregated count of invitation sent...
Ok finally I resolve this issue and get invited friends ids..
As we know we use javascript sdk for FB connect so my solution is in concern of Java script:
Just make on change in your .js file where you put your facebook connect javascript code. Use Get or Request Method instead of Post Method in fb:request-form tag.
<script type="text/javascript>
var fbhtml = "<fb:serverFbml width=\"" + width_of_invitation_div + "\">
<script type=\"text/fbml\"><fb:fbml><fb:request-form action=" + window.location + " method="REQUEST" invite="true" type="" + type_of_fb_request_form + "" hold=" /><br mode="></fb:request-form></fb:fbml></script></fb:serverfbml>"
</script>
After invitation send to users selected friends you get ids[] in url.
you can get these ids through query string and split ids by comma(,) and store in array.
Hope this will help for other devs.

Facebook fan page tab and user id

As per the documentation in the following link, we can get the user id if the uer will interact with the form..
http://wiki.developers.facebook.com/ind … d_Policies
"If a viewing user interacts with the tab (like submits a form, takes an action that causes an AJAX load of new content, or follows a relative URL that loads on the tab), that user's UID is sent to the application as the fb_sig_user parameter, the profile owner's user ID is sent as the fb_sig_profile_user parameter. The viewing user's session key is key is sent only if the user authorized the application. "
In my fan page tab am I have an AJAX form which the user can submit with some value.. now I need the users id also.. how can I get this..
I tried to get the value in my AJAX submit page using $_POST['fb_sig_user'] with no success.. can anyone help me with this please..
You won't be able to get the id of the user using $_POST['fb_sig_user'] unless you authenticate the user by having this in the facebook's ajax function:
ajax.requireLogin = true;
For example, I'm retrieving it fine with this:
function do_ajax(url, div_id)
{
document.getElementById('poller_waitMessage').setStyle('display', 'block');
var ajax = new Ajax();
ajax.responseType = Ajax.FBML;
ajax.onerror = function(error)
{
new Dialog().showMessage("Error:", "Some communication error occured, Please reload the page.","Ok");
};
ajax.ondone = function(data)
{
document.getElementById('poller_waitMessage').setStyle('display', 'none');
document.getElementById(div_id).setInnerFBML(data);
}
ajax.requireLogin = true; // <----- this is important
ajax.post(url);
}
I've been happily using the form variable fb_sig_profile_user for previous apps, and when developing a new app last week, the variable was no where to be found.
Searched for several days, I was about to give up, and then the found answer:
ajax.requireLogin = true;
I understand FB cares about privacy and all, but they really need to announce these kinds of changes before just taking it away.
Million Thanks!

Photos in the Facebook album not showing

I am using Facebook connect and JS client library to retrieve my photos in my Facebook account.
Below is my code:
<div id="photos_pics"></div>
<script type="text/javascript">
var widget_div = document.getElementById("photos_pics");
FB.ensureInit(function () {
FB.Facebook.get_sessionState().waitUntilReady(function() {
FB.Facebook.apiClient.photos_get('12345678', null, null, function(photos,e) {
var markup = "";
for (var i = 0; i < photos.length; i++) {
var photo = photos[i];
var photo_pid = photo.pid;
markup += '<fb:photo size="small" pid="'+photo_pid+'"></fb:photo>';
}
widget_div.innerHTML = markup;
FB.XFBML.Host.parseDomElement(widget_div);
});
});
});
</script>
The below method retrieves the photos:
FB.Facebook.apiClient.photos_get(uid, aid, null, result)
When I only specify uid which is my Facebook id, it works and photos (not in any albums) are returned. But when I specify one of my photo albums in aid, no results returned.
Anyone know what is the error I made? Thanks in advance.
I have recently been having a significant number of problems with retrieving photos from facebook lately as well. Almost always it is revolving around a recent change they have made to pid's. When viewing a photo in facebook you will see two query variables in your url pid and aid.
http://www.facebook.com/home.php#/photo.php?pid=9513212&id=672915455
although this is deceiving because the recent change that facebook made to pid's is that they are actually in the form id_pid so if I were to include the above photo in an fb photo tag it would look like the following
<fb:photo size="small" pid="672915455_9513212"></fb:photo>
Although I am having lots of problem with this because in more than one place facebook is being inconsistent with which form of pid it will return or is looking for.
So my first suggestion is to see which style pid you are receiving and which ones you are trying to use. This is most likely your current problem.
Your next problem is going to be the fact that there is a current bug in the xfbml version of the fb:photo tag. Currently the tag errors out when parsing the new style tags that have an "_" in them. To get around this we simply made a query for the direct url that facebook uses for the image, and display it using a simple html img tag