Why did Marketing Science at Meta develop marsci, an internal R library?

How can we make sure that a new development or insight uncovered by one person effectively transfers to the rest of the team? In small teams we often write single functions, scripts and templates to optimize our personal workflows; but, as the team grows, different people start developing their own tools and code to solve similar problems. The Marketing Science (marsci) R library addresses this issue by centralizing and supporting daily analytical and technical tasks.
This R library started out as a personal repository where I could save queries and repetitive code related to my role as Marketing Science Partner at Meta back in December 2019. As I grew my personal library and shared it with others, it became increasingly useful and came to the attention of my former manager, and afterward, our regional director and VPs, all of whom fully supported the development of the project.
Setting up an R library helped our team address these three main challenges:
- Duplication of work within the team, both in writing the tools and reviewing code.
- Lack of transparency about how tools are written and lack of documentation, often resulting in bugs or incorrect usage.
- Difficulty sharingnew developments with other users, slowing down productivity and missing opportunities.
In this post, I’ll share insights from developing the marsci R library and provide a few tips for developing your own.
How R libraries address scalability challenges
R is an open-source programming language and environment originally designed for statistical computing and graphics. In the last decade, R has become one of the most relevant languages for analytics and data science. It’s a flexible, scalable and popular open-source tool used by analysts around the world.
R packages are the basic units of reproducible code. They can include functions, documentation, data, tests, add-ins, vignettes, R markdown and other templates. By enabling a collaborative, scalable and reproducible system using R packages, we are able to work and collaborate more efficiently.
The marsci R library is an internal R package independently developed and maintained by our team to provide solutions for our daily workflow and common tasks. Think of it as a tool case with tools designed specifically for our team’s needs.
It allows our work to be:
- Collaborative: It centralizes our team’s knowledge into a collaborative quality code repository that is constantly growing, adapting to new priorities, and improving.
- Scalable: It’s maintained and reviewed by few peers, deployed to be used by any team member and cross-functional.
- Reproducible:It saves time by automating and simplifying typical tasks, with robust replicable analysis and reporting.
Usage and impact of the marsci R library
Since the beginning, and now more than ever, the marsci R library aligns with the goals of both Meta and Marketing Science, including Meta’s Year of Efficiency for 2023.
One of our mottos is: “It’s not coding, but running code.” We have numerous senior users in our team with no coding experience that use our marsci R library with little to no guidance to get analyses results and useful outputs. We constantly enable non-technical users to run functions, so that when customizing the arguments, they get exactly the output they need, without actually having to code. We’ve developed a good user experience by trying to think like them, returning meaningful errors that provide potential solutions, automating inputs to reduce decisions and solving general pain points for them.
Here are a few use cases enabled through the marsci R library that have already helped hundreds of internal researchers and analysts make their jobs easier and collaborate with other colleagues:
- Users can query data in a safe, friendly, flexible and peer-reviewed way.
- It has the ability to run robust meta-analyses (descriptive, regression and statistical).
- Deliver auto-approved for external sharing automated PowerPoint reports (meta-analyses, aggregated lift studies results, simulations, among others).
- It can analyze and calculate elasticity, ads contamination, reach overlap, power calculations, and more.
- It has internal functions to easily deal with internal infrastructure issues, dictionaries, and other helper functions for our users.
The marsci R library has also been used to enable a number of public-facing and external projects. To name a couple, studies showing that Connected Brands drive deeper brand outcomes (compared with non-connected campaigns), and how Social Cause Marketing Campaigns bring consumers closer to brands.
Usage and impact of the marsci R library
I’d like to share a few learnings and tips for you and your team that will help develop your own R library:
- Impact: Prioritize your asks and backlogs based on impact. Once your package starts getting popular, everyone will want to have their use cases implemented and automated. I like to keep an Asana with a “backlogs,” “ready to go,” “in progress” and “completed” kind of structure. This structure is especially useful for following up on requests, status updates and dependencies. I also recommend surveying your team every once in a while to uncover pain points and new challenges.
- Updates: Share all relevant changes deployed with your team and stakeholders. For marsci R library, we have an internal group where I share all relevant new features, bugs fixed and changes sorted by importance, and keep users updated. I also tag people as necessary to keep them up to date. It’s important you have a clear and tactical go-to-market strategy to train, educate and inform your team (users and non-users) of the marsci R library’s capabilities. Having regional points of contact definitely helps to achieve these objectives.
- UX: Always keep the user in mind whenever making decisions on default values, potential errors on inputs, wordings on the documentation, or other fixes. If the users love the product, they’ll not only start using the solution, but also recommend it to everyone else on the team.
- Logs: If possible, log the usage of each function and parameter. You’ll be able to measure usage, adoption, impact and help debug. This is how I know which users are new, so we can automatically add them to our internal group and measure timings.
- Version control: Leverage git and version control systems to collaborate with other developers and team members, making sure to clearly update the package versions in case there are issues when deploying new versions.
- Documentation: Even though it’s obvious, having documentation that is clear, easy-to-understand and up to date is as important as it gets. By default, R packages have all functions and parameters updated, but be sure to specify what each argument does, what the possible inputs/ranges/values are, and how these change the outputs. Also, having a nice cheat sheet and some relevant vignettes with common use cases helps!
- Infrastructure: Get to know your infrastructure and its limitations, especially if you (ideally) are deploying the package to be updated in all available servers to all users daily. Also, get an engineer friend or two to agree on best practices for security and deployment.
- Reference: Since the marsci R library was one of the first internal packages to be created by its own team, it has been a useful reference for other teams to check. Make sure you check out other external and internal packages to see how they work!
- Read: Everything else has already been said on developing R packages. Check out “R Packages” by Hadley Wickham and Jenny Bryan and “Developing Packages with the RStudio IDE” on the Posit Support blog.
I highly encourage you and your team to start gathering knowledge to share scalable and reproducible solutions using R libraries. Go and redefine your team’s way of working!
The marsci R library is, and always will be, a solution built for MSPs by MSPs. It will continue to empower us with collaborative, scalable and reproducible solutions to help clients and markets grow using data and science.
This blog was written in collaboration with Bernardo Lares, who created the marsci R library in 2019.
First seen at developers.facebook.com
Introducing Facebook Graph API v18.0 and Marketing API v18.0

Today, we are releasing Facebook Graph API v18.0 and Marketing API v18.0. As part of this release, we are highlighting changes below that we believe are relevant to parts of our developer community. These changes include announcements, product updates, and notifications on deprecations that we believe are relevant to your application(s)’ integration with our platform.
For a complete list of all changes and their details, please visit our changelog.
General Updates
Consolidation of Audience Location Status Options for Location Targeting
As previously announced in May 2023, we have consolidated Audience Location Status to our current default option of “People living in or recently in this location” when choosing the type of audience to reach within their Location Targeting selections. This update reflects a consolidation of other previously available options and removal of our “People traveling in this location” option.
We are making this change as part of our ongoing efforts to deliver more value to businesses, simplify our ads system, and streamline our targeting options in order to increase performance efficiency and remove options that have low usage.
This update will apply to new or duplicated campaigns. Existing campaigns created prior to launch will not be entered in this new experience unless they are in draft mode or duplicated.
Add “add_security_recommendation” and “code_expiration_minutes” to WA Message Templates API
Earlier this year, we released WhatsApp’s authentication solution which enabled creating and sending authentication templates with native buttons and preset authentication messages. With the release of Graph API v18, we’re making improvements to the retrieval of authentication templates, making the end-to-end authentication template process easier for BSPs and businesses.
With Graph API v18, BSPs and businesses can have better visibility into preset authentication message template content after creation. Specifically, payloads will return preset content configuration options, in addition to the text used by WhatsApp. This improvement can enable BSPs and businesses to build “edit” UIs for authentication templates that can be constructed on top of the API.
Note that errors may occur when upgrading to Graph API v18 if BSPs or businesses are taking the entire response from the GET request and providing it back to the POST request to update templates. To resolve, the body/header/footer text fields should be dropped before passing back into the API.
Re-launching dev docs and changelogs for creating Call Ads
- Facebook Reels Placement for Call Ads
Meta is releasing the ability to deliver Call Ads through the Facebook Reels platform. Call ads allow users to call businesses in the moment of consideration when they view an ad, and help businesses drive more complex discussions with interested users. This is an opportunity for businesses to advertise with call ads based on peoples’ real-time behavior on Facebook. Under the Ad set Level within Ads Manager, businesses can choose to add “Facebook Reels” Under the Placements section. - Re-Launching Call Ads via API
On September 12, 2023, we’re providing updated guidance on how to create Call Ads via the API. We are introducing documentation solely for Call Ads, so that 3P developers can more easily create Call Ads’ campaigns and know how to view insights about their ongoing call ad campaigns, including call-related metrics. In the future, we also plan to support Call Add-ons via our API platform. Developers should have access to the general permissions necessary to create general ads in order to create Call Ads via the API platform.Please refer to developer documentation for additional information.
Deprecations & Breaking Changes
Graph API changes for user granular permission feature
We are updating two graph API endpoints for WhatsAppBusinessAccount. These endpoints are as follows:
- Retrieve message templates associated with WhatsAppBusiness Account
- Retrieve phone numbers associated with WhatsAppBusiness Account
With v18, we are rolling out a new feature “user granular permission”. All existing users who are already added to WhatsAppBusinessAccount will be backfilled and will continue to have access (no impact).
The admin has the flexibility to change these permissions. If the admin changes the permission and removes access to view message templates or phone numbers for one of their users, that specific user will start getting an error message saying you do not have permission to view message templates or phone numbers on all versions v18 and older.
Deprecate legacy metrics naming for IG Media and User Insights
Starting on September 12, Instagram will remove duplicative and legacy, insights metrics from the Instagram Graph API in order to share a single source of metrics to our developers.
This new upgrade reduces any confusion as well as increases the reliability and quality of our reporting.
After 90 days of this launch (i.e. December 11, 2023), we will remove all these duplicative and legacy insights metrics from the Instagram Graph API on all versions in order to be more consistent with the Instagram app.
We appreciate all the feedback that we’ve received from our developer community, and look forward to continuing to work together.
Please review the media insights and user insights developer documentation to learn more.
Deprecate all Facebook Wi-Fi v1 and Facebook Wi-Fi v2 endpoints
Facebook Wi-Fi was designed to improve the experience of connecting to Wi-Fi hotspots at businesses. It allowed a merchant’s customers to get free Wi-Fi simply by checking in on Facebook. It also allowed merchants to control who could use their Wi-Fi and for how long, and integrated with ads to enable targeting to customers who had used the merchant’s Wi-Fi. This product was deprecated on June 12, 2023. As the partner notice period has ended, all endpoints used by Facebook Wi-Fi v1 and Facebook Wi-Fi v2 have been deprecated and removed.
API Version Deprecations:
As part of Facebook’s versioning schedule for Graph API and Marketing API, please note the upcoming deprecations:
Graph API
- September 14, 2023: Graph API v11.0 will be deprecated and removed from the platform
- February 8, 2024: Graph API v12.0 will be deprecated and removed from the platform
- May 28, 2024: Graph API v13.0 will be deprecated and removed from the platform
Marketing API
- September 20, 2023: Marketing API v14.0 will be deprecated and removed from the platform
- September 20, 2023: Marketing API v15.0 will be deprecated and removed from the platform
- February 06, 2024: Marketing API v16.0 will be deprecated and removed from the platform
To avoid disruption to your business, we recommend migrating all calls to the latest API version that launched today.
Facebook Platform SDK
As part of our 2-year deprecation schedule for Platform SDKs, please note the upcoming deprecations and sunsets:
- October 2023: Facebook Platform SDK v11.0 or below will be sunset
- February 2024: Facebook Platform SDK v12.0 or below will be sunset
First seen at developers.facebook.com
Allowing Users to Promote Stories as Ads (via Marketing API)

Before today (August 28, 2023), advertisers could not promote images and/or videos used in Instagram Stories as ads via the Instagram Marketing API. This process created unwanted friction for our partners and their customers.
After consistently hearing about this pain point from our developer community, we have removed this unwanted friction for advertisers and now allow users to seamlessly promote their image and/or video media used in Instagram Stories as ads via the Instagram Marketing API as of August 28, 2023.
We appreciate all the feedback received from our developer community, and hope to continue improving your experience.
Please review the developer documentation to learn more.
First seen at developers.facebook.com
Launching second release of Facebook Reels API: An enterprise solution for desktop and web publishers

We’re excited to announce that the second release of FB Reels API is now publicly available for third-party developers. FB Reels API enables users of third-party platforms to share Reels directly to public Facebook Pages and the New Pages Experience.
FB Reels API has grown significantly since the first release in September 2022. The new version of the APIs now support custom thumbnails, automatic music tagging, tagging collaborators, longer format of reels and better error handling.
FB Reels API will also support scheduling and draft capability to allow creators to take advantage of tools provided either by Meta or by our partners. Based on the feedback we received from our partners, we’ll now provide additional audio insights via the Audio Recommendations API and reels performance metrics via the Insights API.
Our goal in the next couple of releases is to continue to make it easier for creators to develop quality content by adding features like early copyright detection and A/B testing. We’re also excited to start working on enhanced creation features like Video clipping- so stay tuned to hear more about those features in the future.
Call-to-Action
If you are a developer interested in integrating with the Facebook Reels API, please refer to the Developer Documents for more info.
Not sure if this product is for you? Check out our entire suite of sharing offerings.
Tune in to Product @scale event to learn more about FB Video APIs and hear from some of our customers.
First seen at developers.facebook.com
-
FACEBOOK2 weeks ago
Introducing Facebook Graph API v18.0 and Marketing API v18.0
-
Uncategorized2 weeks ago
3 Ways To Find Your Instagram Reels History
-
Uncategorized2 weeks ago
Community Manager: Job Description & Key Responsibilities
-
LINKEDIN2 weeks ago
Career Stories: Learning and growing through mentorship and community
-
Uncategorized2 weeks ago
Facebook Page Template Guide: Choose the Best One
-
OTHER6 days ago
WhatsApp iPad Support Spotted in Testing on Latest iOS Beta, Improved Group Calls Interface on Android
-
Uncategorized1 week ago
The Complete Guide to Social Media Video Specs in 2023
-
LINKEDIN5 days ago
Career stories: Influencing engineering growth at LinkedIn