UserID is not coming for Pageviews/Transactions in Universal Analytics - universal-analytics

I am pushing UserID to dataLayer each time on page load. When I visit any page with one user as logged in I am able to catch userID for that user in GA dashboard.
Problem is, if I do not close browser and log out and then sign in with another user, All the pageviews (including previous which were with different user id) are coming up against last pushed UserID. Previous UserID is not visible in GA Dashboard.
I checked that all the time whenever page loads we push correct userID in datalayer variable.
I have also tried to change scope of UserId variable in GTM, but it didn't worked.
Thanks for help in advance.

Related

Tracking user activities on facebook

I've created a Facebook page and implemented an application for it too. Now, my aim is that, a user must like and share page with at least one friend to be able to participate/to get access to the app and consequently use it (play the game). Or simply force a user to like and share the page. Can you please tell me if this is even possible and how it can be achieved?
When user visits your Facebook page, you receive signed_request , which contains some information about the user, including whether or not the user liked your page. For share, you will probably need to implement send dialog. In documentation it is said that user takes action (send or cancel) he will be redirected to url you set up, and if the action was "cancel", there will be an error.
So you will probably need to create db where you store user id and whether or not he shared your page before (since you can check if he liked the page at any time).

Facebook get user id

I am making a simple contest on Facebook which is a form to fill in.
I would like to add a mechanism with share options.
You will win another chance for each friend who will click on the back link.
Technically i wish to add to the shared url the user id to add 1 chance for him in my database (sharing options will appear after the form)
So i need the user id but i don't want to display the FB popup "accept this application" before launching my app. Is it possible?
If not, do you have an id or online to do it with open graph and all that stuff?
There is no way to get the User-/Facebook-ID of the user without login/authorization. The signed request variable only presents basic infos if the user is not logged in (like status, admin status, locale, ...).
So, in order to get the User ID you have to authorize the user, i recommend the JavaScript SDK for this:
https://developers.facebook.com/docs/howtos/login/getting-started/
This is against the Facebook Page Terms.
You can not have a contest where sharing is considered a entry in a contest.
Follow this link and look at Section III.E.3 for details
https://www.facebook.com/page_guidelines.php

Facebook return ID and me.name

I am really lost with these two problems with Facebook API...
All has been working fine posting to user walls, but I have one client with a page. The page was created from scratch, not via themselves as a user - ie they did not login and create a page they just started from the Facebook welcome screen>create page.
There page works fine, however,
1) Our system is submitting a post via API and receiving an ID in return (eg {"id":"123456_123456"} back from Facebook - this tells me facebook has accepted it and has given me an ID for the post.
However, the post DOES NOT appear on the page it relates to (and I have checked where it is submitting it to and it is the correct User ID). This system has been working fine for all other users.
2) When the login occurs via Javascript for this user, we get an empty value for "me.name" (we get me.email etc, just no name)
Is all this normal, or do pages have a different technique to posting and retrieving data?
Email is a private data of facebook user , It is a permission issue what you are encountering
The only way to get the users e-mail address is to request extended permissions on the email field.
After logging in .
This is how facebook api works , w.r.t revealing private data of its users
Ok I solved this one, I don't doubt the ability of anyone here - perhaps my question is still being misunderstood...
Some Facebook pages (especially business pages) where the page hasn't been created by an existing user are different to Facebook groups and user pages. You cannot just submit using an short ot long term access token.
You have to call facebook as http://graph.facebook.com/ID_OF_PAGE/accounts with your token first.
Facebook returns a list of pages, each with their own unique ID and a token for each.
You then grab the token for the page you want then resubmit with the page ID and that pages OWN token - and voila it posts to it!
Their are still bugs with Facebook as I found. It says on one business page I created for a client "Use Facebook as ." - ie the name is missing before the "." - it should say "Use Facebook as MYNAME."
This introduced another problem with the JS FB.login because the name of the person returns undefined. I had to verify their Email instead - other wise it says "You are logged in as ."
I think its because FB lets you create a page from scratch, as a new user, and without logging in as yourself - then some values are not being set and it messes up.
Perhaps may help someone...

Can't retrieve valid online presence data from Facebook with proper privilege set and user being online

I'm facing a trouble with some code that used to work before. I want to retrieve information whether user is currently online on Facebook's website chat. Thus, I'm requesting access token with 'user_online_presence' privilege and when running fql query:
"SELECT uid, name, pic_big, online_presence, status, current_location
FROM user
WHERE uid="+userId
(where userId is replaced by the real id of the user)
'online_presence' field is always 'offline' although I have my test account opened in the browser and test user is online for chat. All other information is presented correctly. And I know that this code used to work couple of months ago. I tried with several user account, but the same result always.
Is anyone facing similar issues? Has there been any API change I'm not aware of (I did search for the ones related to the online_presence field in 'user' table but without any success)?
Thanks a lot!
It's a long shot, but have you tried using WHERE id = me() rather than feeding in the user id?

Automatically like a page in Facebook based on user long live token

As the title reads...
is this possibly?
Workflow should be like:
1.- User is registered, he receives a barcode with a numeric ID.
2.- Time later the user scans barcode in embedded device, it posts the numeric ID to some php magic... and he automatically is noted as "liking" (user likes x) a certain page, no login, no nothing, we should get the user data just based on our first registration. The (embedded device/computer/thing that reads barcodes) must be headless.
Is this even possibly with the current Facebook oAuth model??
Thanks in advance.
It is not allowed as the terms of service now.