Our site publishes articles on WordPress and also provides some of these posts to Facebook Instant Articles in a feed.
I'm in the process of upgrading our site's Google Analytics code to Universal Analytics. We're using the dc.js version with display features.
On our current Facebook Instant Article template the GA code is like
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XXXXXXXXXXXXX']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_setCampSourceKey', 'itx']);
_gaq.push(['_setReferrerOverride', 'http://fbia.facebook.com']);
_gaq.push(['_trackPageview']);
I don't understand all of these settings myself. From what I read the _setDomainName value sets cookie access to the current domain only, whereas _setAllowLinker allows GA to link activity tracked on different domains.
I do know that itx is an argument we commonly append to URLs to indicate the source of clicks. And with _setReferrerOverride we set an arbitrary referrer value that allows us to separate out FBIA activity in the GA reports.
My question is, do I need to do cross-domain tracking with FBIA articles? And if so, how would I do it?
It seems that the Universal Analytics way of doing cross-domain is to specify the "other" domains you want to link to in a linker:autolink statement. But what domain would I specify for an FBIA article?
In case useful to anybody else, this is how I think the legacy GA code could be translated to Universal on FBIA tracking.
ga('create', 'XXXXXXXXXXXXX', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['xxxxx.com']);
ga('require', 'displayfeatures');
ga('set', 'campaignSource', 'Facebook');
ga('set', 'campaignMedium', 'Social Instant Article');
ga('set', 'title', ia_document.title);
ga('set', 'referrer', 'http://fbia.facebook.com');
ga('send', 'pageview');
Related
I wonder if someone may be able to help.
Recently, we realised we had to get consent for using the Facebook pixel on our site. I have looked at the developer information on Facebook on how to do this, and I can stop the pixel from sending data to Facebook...
What I need help with is allowing the data to be sent if the visitor accepts the cookies in the BigCommerce cookie bar (say for either the analytics or Targeting; Advertising category) ... the code I have so far in script manager to stop sending the data is this (to note I removed our FB pixel ID and replaced with 0's for this example) I tried to connect it to the BigCommerce cookie banner but failed (I was trying to use tag manager but this failed also):
<!-- 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('consent', 'revoke');
fbq('init', '000000000000000');
fbq('track', 'PageView');
</script>
<!-- End Facebook Pixel Code -->
As you can see I added the fbq('consent', 'revoke'); to the code
More info from Facebook here regarding the codes to use: https://developers.facebook.com/docs/facebook-pixel/implementation/gdpr/
Thank you for any help you can offer with this 😃 our site is https://www.wolftucker.co.uk
The BigCommerce consent banner sets a cookie (bc_consent) with details on what the user has consented to. You can use that to decide if you need to do the revoke command.
Alternatively you can add your code using the script manager and set the script category to "Targeting; Advertising". This will remove the script if consent is not given.
Is there a way to see how many sessions are cast to users’ TVs (e.g., from iPhone to Apple TV, or from Android to Chromecast)?
You can use an analytics solution like Google Analytics to track and count any events from your application, including CAST events.
You can see more info here about Google analytics specifically: https://developers.google.com/analytics/devguides/collection/analyticsjs/events
A simple example, modified from one at the above link, might be:
ga('send', {
hitType: 'event',
eventCategory: 'Videos',
eventAction: 'Cast',
eventLabel: 'Fall Campaign'
});
I would like to use offline conversion data to build a custom audience that I can match against visitors to my site.
I am currently trying to do this by:
Using the Facebook pixel (fbevents.js) to track users, passing extern_id with our unique user ID during the init call and then tracking pageviews like so:
fbq('init', '1234567890', {extern_id: UNIQUE_USER_ID});
fbq('track', 'PageView');
Later uploading offline event data with the associated extern_id of people that have made purchases
But Facebook is giving me a 0% record match rate for the offline event set (I have ~150,000 pageviews and a couple thousand purchases, if that matters). Has anybody succeeded in matching only on extern_id, or does Facebook require more user data?
I spent hours on this and from what I can gather, the offline events only work in conjunction with Facebook ads. So, your uploaded data is matched only against ads in your account and not the Facebook pixel.
You should be passing external_id instead of extern_id in the fbq init event.
fbq('init', '1234567890', {extern_id: UNIQUE_USER_ID}); // Incorrect
fbq('init', '1234567890', {external_id: UNIQUE_USER_ID}); // Correct
You can check the doc here:
https://developers.facebook.com/docs/facebook-pixel/advanced/advanced-matching
I'm using Sitecore Social Connect to log users into my website using Facebook & Twitter. Sitecore's documentation has detailed instructions on how to post to a user's timeline using Marketing Goals, but I'm wondering if there's another way to do this. Is it something I can do directly through the API? Pretty much any other options would be worth exploring. There's not a ton of documentation around this.
Social connected messages must be associated with either content items or marketing goals, but it is possible to trigger a marketing goal using the API:
GoalUtil.RegisterEventParameters("Goal Name", new Dictionary<string,string>());
This fires the goal, and has the additional feature of allowing you to replace tokens in the message text. For example, if you defined a Goal named "Mayor", and create an associated Facebook message with this text: "I've just become mayor of $place.", you can cause this to appear on a user's Facebook wall specific text by doing this:
var tokens = new Dictionary<string, string>();
tokens.Add("place", "New York");
GoalUtil.RegisterEventParameters("Mayor", tokens);
This message will appear on the users wall: "I've just become mayor of New York." Notice that the dollar sign appears in the message, but not in the token key value added to the dictionary. GoalUtil is in the namespace: Sitecore.Social.Core.Publishing.Utils, in the Sitecore.Social.Core.dll.
In addition, when a message is associated with a goal, the following rule is added to the goal:
where true (actions always execute)
post associated messages
You can replace the always true condition with different logic, possibly using Rules Engine conditions you have authored, to restrict messages to meet the required business logic.
We used the facebook js API itself to achieve this:
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
var facebookAppId = '<%=FacebookDefaultAppId %>';
FB.init({ appId: facebookAppId, status: true, cookie: true, xfbml: true });
function openFbPopUp() {
FB.ui({
method: 'feed',
name: 'Your Site Name',
caption: ' ',
link: document.URL, // Current Url
description: $('#quotes').html(),
// Description from the sitecore item which was available in the same page
display: 'popup'
});
return false;
}
</script>
FacebookDefaultAppId - was the app id (Application Id) set in the sitecore item where we set the facebook app details:
Which we get here in facebook for the app created:
Truth be told, this solution has nothing to do with sitecore, but since we manage the app secret key in sitecore, I am pulling it in from there as opposed to saving it some place else too.
This results in the following when the js is triggered (say on button click):
Sitecore Social Connected API was introduced in the 1.3.1 version. The API documentation is available here: http://sdn.sitecore.net/Products/Social%20Connected%20Module/Social%20Connected%201,-d-,3/Documentation.aspx
Using JavaScript SDK, it is possible to wall post with user's consent. Since It can be done entirely on client side, how to prevent someone to post something to their wall on behalf of my application, tampering with fields the fields like "picture", "link", "caption" and "description"?
Edit for the bounty:
Bragging is an essential part of any game, including online games. In my web game I want to enable users to brag on Facebook when they win, but I don't want them to be able to forge some post and send via my application, what would allow them to brag without actually winning. They may only publish something via my application if I actually allow them to do (I can only imagine some way to ensure this by using some authenticated server side API).
Facebook's Feed Dialog allows developers to prompt users if they want to publish something in their wall, and I well could use it to publish the user's winning story. The problem is that that API is entirely client-side, and can be used via Javascript SDK or just by forging an URL. I was able to forge a post in the name of my application by just filling the fields in an URL, like this given example:
https://www.facebook.com/dialog/feed?
app_id=123050457758183&
link=https://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&
name=Facebook%20Dialogs&
caption=Reference%20Documentation&
description=Using%20Dialogs%20to%20interact%20with%20users.&
redirect_uri=http://www.example.com/response
The problem is that I was unable to forge such request for an existing application, like Robot Unicorn Attack : Evolution. Thus, either 1) I don't know how to forge a request to this application and that is still possible and there is no safety or 2) it is possible to prevent client side exploitation of the Facebook's API, and I don't know how to do this on my application.
So, for the bounty sake, I will consider a proper answer either 1) some proof that it is always possible to forge a post on behalf of some application, and by that I would require a way to post whatever I want on behalf of Robot Unicorn Attack : Evolution, or 2) a way to prevent users to forge feed posts on behalf of my application, in a way I can no longer do it without having server-side only information.
If you want to post anything on behalf of Robot Unicorn Attack : Evolution do the following:
0) Make sure you have added the app.
1) Using Chrome, go to https://s.adultswim.com/games3/fb-game-files/robotunicornattackevolution-sec/index.html (this URL was located by inspecting the action of the form tag above the iframe of the content on the canvas page)
2) Open Developer Tools
3) In the Console paste this:
FB.ui({
method: 'feed',
name: 'There is no security',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
caption: 'I can post whatever i want',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
});
4) Hit enter and see the dialog pop up on the page
1) some proof that it is always possible to forge a post on behalf of
some application, and by that I would require a way to post whatever I
want on behalf of Robot Unicorn Attack : Evolution,
You have already done that. Keep Self proof. Hence proved.
2) a way to prevent users to forge feed posts on behalf of my
application, in a way I can no longer do it without having server-side
only information.
feed posts need is an application id, which cannot be hidden. So as long as you have an application - anyone may post on its behalf . (according to me.)