Connect with us

FACEBOOK

Simplifying analytics for Messenger bots

Published

on

For the busy developers or lazy readers: We have a new toy for you. Go and have fun! 🤝

It’s conventional wisdom that you can’t improve something that you can’t measure. Product usage data is not only interesting and nice to have, but an important foundation for making the right product decisions and assessing the effectiveness and ROI of your Messenger bot compared to other channels.

Example bot funnel for an e-commerce flow

For traditional websites, there is a myriad of tools and services available that web developers can use. This article outlines the best practice for using Facebook Analytics for Messenger bots and introduces an npm package which is aimed at helping developers to make integration effortless.

Experienced bot developers know that launching a conversational experience is only the start of the journey to improving your service over time — based on real user interactions. It’s a tough, but rewarding challenge because conversations are not deterministic by nature like graphical user interfaces. In other words, the bandwidth of user actions is much wider than on traditional websites where the user can scroll, click pre-defined buttons, and write text in known input fields or text areas.

On the Messenger platform, the most integrated way to log bot activity is to use Facebook Analytics (FBA) in form of custom app events through the app activities endpoint. Although logging an event to FBA only requires a simple API call, many bot developers skip this step and launch Messenger experiences without having a measurement framework in place.

The Partner Engineering team at Facebook has therefore set out to simplify event logging for Messenger bots. The result is a thin integration layer that sits between your Messenger bot and Facebook Analytics.

Meet the messenger-analytics package

The messenger-analytics package offers a simple interface to Facebook Analytics (FBA) for Messenger bots. It provides a thin integration layer as well as a collection of commonly used bot events to give you a basic idea of useful metrics.

Facebook Analytics (FBA) is a people-first analytics tool for an omni-channel world. It can be used as a standalone logging solution for your Messenger bot or in addition to other analytics software. FBA is closely integrated with the Facebook ecosystem, including Ads Manager and the Facebook Pixel. This allows you to optimize your campaigns for specific actions in the bot and to combine pixel data from your website with Messenger bot activity.

A question that Facebook Analytics can answer: “How many people purchased an item on my website after having been consulted by the bot beforehand?”

The Facebook Messenger platform automatically logs certain events for your bot, for example “message sent” and “message received”. These events are logged on the app-level and can be visualized in Facebook Analytics (FBA).

In addition to these automatic events, FBA also supports the logging of custom events which enable you to visualize user journeys and track the performance metrics of your choice. The messenger-analytics package helps you to log custom events in Facebook Analytics.

Installation

npm install --save messenger-analytics

Import

const FBA = require("messenger-analytics");

Creating an event logger

Create a logger using the app and page ID associated with your bot.

const logger = new FBA.Logger({
appID: YOUR_APP_ID,
pageID: YOUR_PAGE_ID,
});

Logging events

The simplest form of logging an event is to provide an event name and the user identifier (PSID). You can either use an event name defined in this module or choose an arbitrary name.

Note: Whenever possible and applicable, use the so called predefined app events in FBA.EventNames.Predefined. They are utilized across the Facebook ecosystem and are needed for campaign attribution and optimization in Ads Manager. Given the significance of these events for other Facebook products and services, it is advisable to treat them as first choice.

// Using a predefined event name (required if you want to report on a specific metric in Ads Manager)
logger.logEvent(
FBA.EventNames.Predefined.Purchased,
"USER_PSID",
).then(() => {
console.log("Event successfully logged to FBA.");
}).catch((err) => {
console.error(err);
});// Using a custom event name
logger.logEvent(
"subscribed_sports_news",
"USER_PSID",
).then(() => {
console.log("Event successfully logged to FBA.");
}).catch((err) => {
console.error(err);
});

You may also attach parameters to an event. These parameters can be used for filtering, segmentation, and campaign reporting. Predefined events have specific parameter definitions which need to be followed if you want to log purchases and see the purchase value and currency in Ads Manager, as an example. The parameter definitions can be found in the App Events API event structure.

On top of these standard parameters, you may also log additional custom parameters. Parameters for custom events don’t have to follow any naming convention.

// Purchase event with 3 standard 1 custom parameters
logger.logEvent(
FBA.EventNames.Predefined.Purchased,
"USER_PSID",
{
_valueToSum: 87.90, // standard parameter, defaults to 1
fb_num_items: 3, // standard parameter
fb_currency: "EUR", // standard parameter
custom_var: "hello_world", // custom parameter
}
).then(() => {
console.log("Event successfully logged to FBA.");
}).catch((err) => {
console.error(err);
});

These parameters can then be used in FBA to filter your results:

Filtering events by parameters

Platform and language availability

We chose to publish this analytics package for bots built on NodeJS (written in JavaScript) first. Depending on popularity and demand, we might follow up with implementations for other popular “bot builder languages” like PHP, C#, Ruby, or Python. If you have a preference, let us know in the comments! 🙂 In the meantime, you can simply send your requests straight to FBA using our the analytics quick start guide.

Facebook Analytics for Messenger is MIT licensed.

Messenger Developer Blog

FACEBOOK

Making Apps Easier to Access as Demand Surges

Published

on

As more people shelter and take to the web, simplifying their login experiences is proving helpful

As more people adapt to new public health and safety measures, they’re increasingly turning to apps for communication, connection and community — from text and video chat, to gaming and entertainment, to social good. We’re seeing spikes in usage across a wide range of interests and activities.

With this in mind, we think it’s important that app developers understand what they can do, today, to anticipate and help ease any friction users might experience as day-to-day needs continue to surge.

Over the last few months, we’ve seen above average usage of Facebook Login, which lets people use their Facebook account to login to numerous apps and sites. When Android features such as Custom Tabs and/or Express Login are used to open Facebook Login, people are able to connect to apps at higher rates.

We think there’s a strong signal that seamless login products like Facebook Login and its Android features are making it easier for people to quickly connect with their passions and interests at this time of increasing need.

And beyond what the data tells us, we’re anecdotally hearing this directly from developers too.

For example, the team at Wink says users are spending significantly longer times on its video chat app, and that Facebook Login is helping to boost its registration numbers:

“The biggest challenge now is that millions of people worldwide are forced to stay home, so online social connections are more important than ever. We’re seeing significant uptick in organic traffic to Wink from many countries, and users are spending significantly longer time on our app, to chat by voice and video with other users around the world. Facebook Login offers a lower friction registration process, and it’s helping to increase our registration completion rate.” – Andy Tian, CEO of Asia Innovations Group

Additionally, Mattel163, which has seen a spike in people playing UNO, thinks simplifying its login process is making it easier for groups to quickly connect to have some fun:

“There is a need to stay connected with one another, no matter how far apart. With the help of Facebook Login, Mattel163 has been able to provide social connectivity and joy through UNO. UNO players can join the game and share their special in-game moments on Facebook. Once in the game, players can add each other as friends, play together in a team-based 2V2 session, or set up a private game in Room Mode with friends. Recently, we provided free Room Mode to all players, where friends can meet, chat, customize rules, and goof off as if they were playing traditional UNO.” – Amy Huang, CEO of Mattel163

It’s clear apps are playing a critical role right now, helping people all over the world connect to their loved ones, interests and needs. If you’re a developer looking for ways to enable and help people at this time, evaluating your login experience may be a helpful place to start.

We have a collection of best practices, implementation examples and other resources for developers interested in implementing Facebook Login. Similarly, if you’d like to explore how to optimize this for Android users, make sure you’re using the updated Android SDK (which includes Custom Tabs for Android by default), and enable Express Login.

Facebook Developers

Continue Reading

FACEBOOK

How Startups are Pivoting During the Pandemic

Published

on

Businesses throughout the world are facing unprecedented obstacles because of COVID-19. And for startups, the economic implications of the pandemic will have long-lasting effects. While the challenges are still new, businesses are already reevaluating their goals, customer relationships, marketing tactics, and staffing models in order to weather the storm. Here’s how four startups are rethinking business strategies, supporting each other, and helping communities as they pave the way for the future.

In the UK, Collective Benefits, a Facebook Accelerator London alumni startup that provides big company benefits for the self-employed, has seen an uptick in demand for its services. “We’ve been overwhelmed with enquiries from the self-employed looking for protections and a safety net. They need financial support now,” says Kimberly Hurd, CRO. “To help, we accelerated the launch of our direct-to-consumer beta program to give freelancers direct access to our benefits and protections like sick pay. We ran a four-day, full-team sprint to open up to our waitlist and were completely overwhelmed by the response.”

In addition to providing more benefits to more people, Kimberly and her team have partnered with the UK Fintech and freelancer community to lobby for clearer and quicker income support for the self-employed. With the influx of work to be done, Kimberly has made a concerted effort to help her team focus on their health during this time. “We mandate breaks. It’s important to give time and space to reflect, think and focus on family and mental and physical health.”

While businesses like Kimberly’s are dealing with an increase in demand, other businesses are pivoting to focus on new business goals. “Don’t waste a crisis. Adapt quickly and take the opportunity to prepare for the future,” says Roger Do, CEO at QSearch, a Facebook Accelerator startup based in Singapore. QSearch offers a social listening dashboard where customers can easily create and test communication strategies on platforms like Facebook. “With the pandemic, we saw a need to bring forward some of our product development plans and accelerate the shift towards AI and machine learning. We were planning to gradually make that shift in two-years’ time, but to ensure our product is relevant and timely given the changing times, we’ve moved fast to accelerate this in just two months,” says Roger.

QSearch’s ability to quickly change its course is paying off. “As a result, we’ve seen a reduced cost of data analysis by 70% and our clients are also experiencing a higher ROI for their spend,” says Roger. Through the struggle, the one thing that Roger says helps is the support of the business community. “The Asian business community’s response has been inspiring to see. Instead of sitting on the sidelines, everyone in the startup ecosystem is chipping in to help and do our part.”

This support expands beyond Asia into other countries where startups are banding together to support one another. “Being in touch with other entrepreneurs during this hard time is helping me a lot,” says Felipe Miranda Costa, CEO and CTO at Cloudia—a Brazil-based company offering virtual assistants for modern health clinics. “In each conversation I have with a peer, there are always some good insights.”

During the pandemic, Felipe’s team has partnered up with Colab, a startup they met while participating in Hack Station, the Facebook Accelerator program in Sao Paulo. Together they’re working on a project called Brasil Sem Corona (Brazil without Corona) to help monitor the number of people infected by the virus throughout the country. Cloudia also created a chatbot to answer questions and concerns about COVID-19 that its customers can use with their patients.

Like Cloudia, many startups are working to provide helpful and accurate information about the pandemic. Facebook Accelerator alumni Turn.IO, a company committed to giving social impact organisations a platform to have conversations that improve lives, is doing just that. “With countries experiencing a massive need for direct communication about COVID-19, Turn.io developed a pro bono solution—HealhAlert,” says Lieze Langford, Business Manager at Turn.io. “HealthAlert disseminates accurate, timely information to the public via WhatsApp at population scale.”

The team is partnering with the World Health Organization (WHO) to provide information and support to any person using WhatsApp in the world. “Our strategy remains the same, but the execution has focused on faster roll-out and standardised content and user experiences so that global NGOs and governments can launch WhatsApp solutions within a week,” says Lieze. While these times are especially challenging for startups in all parts of the world, startups like these are finding ways to focus on new opportunities at hand that not only support their companies but the lives of those around them.

Looking for additional resources to keep your operation running smoothly? Check out our COVID-19 resource page for tips on running a business during economic downturns, social distancing and well-being. We’ve included a list of Facebook startup program alumni that have been identified as startups that are actively supporting COVID-19 response efforts. If you’re a startup that would like to be featured on our resource page or want to learn more about what our startup program alumni are doing to address COVID-19 challenges, please send a direct message to our Facebook for Startups page.

Facebook Developers

Continue Reading

FACEBOOK

Introducing Graph API v7.0 and Marketing API v7.0

Published

on

API Updates Provide Developers with Improved App Permissions and Campaign Controls
New Requirements Outlined for Mobile Developers and Facebook App Review

Today, we’re releasing Graph API v7.0 and Marketing API v7.0, along with v7.0 of the Mobile and Business SDKs. Together, these releases capture several timely updates, including new fields developers can use for the Instagram Hashtag Search API and Special Ad Categories and new permissions for page-related data. Additionally, we’re noting some important new requirements for mobile developers.

Lastly, we do have some API deprecations planned, however, we reduced the number in order to help minimize disruptions for our developer community during this challenging time. We have a lot of exciting updates to share with you, let’s dig in:

New Fields for Instagram Hashtag Search API & Special Ad Categories

We’re adding a timestamp field to the Instagram Hashtag Search API which will allow developers to get the creation time for any post accessible via this API. You can learn more about how to access this field in our v7.0 changelog.

We’re also making a minor, but important change to the special_ad_category field — we’re renaming it to special_ad_categories (note the change from singular to plural). Developers can specify a single special ad category (i.e., housing, employment, credit, or none) at the campaign-level. If your campaign does not need a special ad category, you can simply pass in an empty array, or [NONE] as the value.

New Permissions for Apps to Read/Write Page Data

We’re announcing six new permissions to replace manage_pages and publish_pages, all of which are outlined in our v7.0 changelog. Taken together, these new permissions will provide developers with more access and better control over page-related data. Availability of these new permissions will be released on a rolling basis, starting today through June 1, 2020.

Developers that already have access to manage_pages and publish_pages will be automatically migrated to the relevant, new permissions by June 1, 2020, and access will remain undisrupted.

Developers with no existing access to manage_pages or publish_pages should actively monitor their app dashboard for the new permissions as they begin rolling out today. By June 1, 2020, all developers will see the new permissions and are encouraged to apply. After this date, applications for manage_pages and publish_pages will be unavailable and no longer reviewed.

Finally, developers who have recently applied for access to manage_pages and publish_pages will continue to be reviewed, and if approved, will be automatically migrated to the relevant, new permissions.

New Deadlines & Requirements for Mobile Developers

If you’re an iOS developer, it’s important to point out Apple’s recent announcement, which states apps for iPhone or iPad must be built with the iOS 13 SDK or later and use Xcode 11 or later. The deadline for adhering to these new iOS requirements is June 30, 2020.

And if you’re an Android developer, note that Android SDK will now be using the Android X libraries. All apps leveraging the Facebook SDK v7.0 must migrate to Android X for continued use.

Important API Deprecations

As part of our ongoing commitment to privacy and security, we are removing access to a number of APIs. However, as a means of minimizing disruption for our developers in the current COVID-19 climate, we significantly reduced the number of APIs we are removing access to.

A list of endpoints that will be removed from the platform are listed in the v7.0 changelog, within their product or node sections. You should review this list to see if your app is impacted.

Also, please be aware of the upcoming version deprecations:

  • 7/26/2020 – Graph API v3.0 will no longer be available.

As always, if you have specific questions or concerns, there’s Facebook Developer Support. And if you haven’t already, please consider joining the Facebook Developer Community — it’s a tremendously helpful resource for communicating and connecting with Facebook developers all over the world.

Facebook Developers

Continue Reading

Trending