social media sharing and tracking - facebook

Is there a way to track when user visits our page from social media like facebook, twitter or pinterest?
is there a way to add some parameters to the url so that it will be easier to track?

<?php
echo $_SERVER['HTTP_REFERER'];
?>
This tiny php script enables you to know from where the user came from.
EDITS
As nyshangal asked for jsp code
JSP
request.getHeader("Referer");
I am not good at JSP. After googling I found that this above code will return the referrer from where the user came from.
Thank you

Related

Facebook feed sharing on wordpress

https://developers.facebook.com/docs/reference/dialogs/feed/
I am trying to use that to have a share button on my content-blog.php page in wordpress. So on all the post excerpts that come up each one can be shared.
But if i put in the <?php the_permalink() ?> or <?php the_title() ?> in the appropriate sections they all have the same link and title.
Does anyone know how to make sure each button shares the appropriate stuff?
My site is dontstopdreaming.net you can see what happens when you click on the 'post to feed' text it will come up with same stuff for each post. Apart from the wrong data everything else is fine i have the app id and everything prepared.
Any help would be appreciated!
a.) Your site news/posts to facebook page/profile:
There is offical Facebook plugin for wordpress. It will solve your issue.
https://developers.facebook.com/wordpress/
The best wordpress to social networks plugin:
http://wordpress.org/plugins/social-networks-auto-poster-facebook-twitter-g/
other; 45+ useful wordpress plugins for facebook.-> http://www.tripwiremagazine.com/2013/06/best-wordpress-facebook-plugins.html
b.) Facebook feeds to your site
This plugin -> http://wordpress.org/plugins/facebook-feed-grabber/
This widget-> http://wordpress.org/plugins/fbf-facebook-page-feed-widget/
other; http://wordpress.org/plugins/jsl3-facebook-wall-feed/, http://wordpress.org/plugins/custom-facebook-feed/

linking back to facebook tab url

I added a code to my zencart products page that is integrated into a facebook tab so that a user can "like" a product and it is posted on their wall with a picture of the product and a link back to the product (I copied the code from this site: http://www.navspan.com/ecommerce/facebook-like-twitter-google-zen-cart.htm#comment-305).
The problem is the link back to the product goes to the site but not within the facebook iframe (ie the tab)... it goes to my hosting account that I have the site setup on with a correct link to the product... but again not within facebook...
The two reasons I want it to stay within facebook is: first, the site is styled to be in the iframe and looks broken outside of it and second I want the users to move between their activity on facebook and buying the product on the fanpages tab seamlessly... So here is the code that I don't know how to modify:
<link rel="image_src" href="<?php echo "http://" . $_SERVER['HTTP_HOST'] . "/images/" . $products_image; ?>" />
Can I replace the "http://" with the unique facebook fanpage url? but I don't know how to get the fanpage url to go directly to the correct product...
Thoughts?
To link to other pages within your Facebook app, your URLs will need to look something like this:
http://facebook.com/YOUR_PAGE/YOUR_APP?app_data=UNIQUE_CONTENT_STRING
This app_data and several other pieces of data will be POSTed to your server whenever Facebook requests a page. You'll need to create a handler on your end to decode the signed_request extract the string from app_data and then make the appropriate queries on the back end to display the correct information to your user.
I found this example that might point you in the right direction.
I'm not too familiar with ZenCart, but this looks like it's going to be a pretty heavy-duty hack. It would definitely be worthwhile to spend some time looking for a Zen Cart plugin that might do this for you.
If you're going to do it yourself, you'll need to url_encode everything that would appear after the ? in one of your urls and pass this into app_data. So to link to the page that shows your Queen Collar Necklace, your URL would look something like this:
http://www.facebook.com/TracyLoganDesigns/app_422210754456200?app_data=main_page%3Dproduct_info%26cPath%3D1_13%26products_id%3D2%26zenid%3D2e0d1920f964cc9887f74ea0c9b8903c%23.T7VEZsXi1j1
Good luck.

How to add facebook like in multiple blog post like your index file in wordpress?

i would like to implement or add a facebook like button in my wordpress blog. But this time, i want it on my index file or in a multiple blog post. The problem is when I copy pasted what facebook is generating for me is it only "likes" my domain name or my index file, not the blog post which is suppose to be liked.
What should i do to correctly add the facebook like button to work?
thank you very much!
it's very simple actually. You still need the codes for Facebook Like button but you have to modify it. Add the value <?php the_permalink(); ?> in the url to like and that's it.
Just make sure that you have the correct meta tags such as title and description so that facebook can successfully scrape your blogpost.

How to prevent others from using my facebook application?

I just created a Facebook application that basically creates a new Tab on my Facebook-profile-page and loads contents from my website in an inline frame. Now I got to the point that I added the application to my profile page with a simple link like http://facebook.com/add.php?api_key=APP_ID&pages=1. But how can I prevent others from just doing the same and using my app on their pages then?
Thanks in advance!
Aha! You know the page that it is supposed to belong to, so hard code that in your app's code and you can check the page id coming in from the signed_request and see if that page id is yours. If not, send down not permitted in your response HTML. If it is your page, then response down the good HTML. :)
For more information on signed_request see: https://developers.facebook.com/docs/authentication/signed_request/

Facebook pages question

I have a few questions that I hope some can help with, I am creating a facebook page for a business and they are wanting to display a list of products, that are pulled directly from there own website, is it possible to pull an XML feed from the website, then display the data using FBML? Secondly is it possible to only show certain content if the user has 'liked the page'?
Thanks
You will have to do this with a script on your server. E.g. a PHP-script which fetches the XML and outputs FBML.
FBML has been deprecated so building something with it is risky. It might stop working suddenly.
For showing content only to users that liked you fan page you can use following:
<fb:visible-to-connection>
Content for fans goes here
<fb:else>
You are not a fan, you do not have access to this content
</fb:else>
</fb:visible-to-connection>
For XML displaying of product you will have to build a facebook application that will run in fan tab tab.