Juan Benavides Nanni; SDET II |
Pinterest conversions are vital for companies trying to optimize their campaigns and monitor the efficiency of their ads. By leveraging Pinterest’s Conversion API and Conversion Tag, advertisers can acquire deeper insights into consumer habits and fine-tune their advertising and marketing efforts.
To make this course of seamless for builders, we’ve created two NPM packages: pinterest-conversions-server and pinterest-conversions-client. These packages simplify the mixing of Pinterest’s Conversion API and Conversion Tag, providing strong options for server-side and client-side monitoring.
Pinterest conversions enable companies to:
- Observe helpful consumer actions like purchases, sign-ups, and extra
- Attribute these actions to particular Pinterest campaigns for higher ROI evaluation
- Allow retargeting and audience-building based mostly on collected occasion information
Nonetheless, implementing these options typically requires advanced setup and information of Pinterest’s API. Our packages assist take away these obstacles, making integration quicker and extra developer-friendly.
Our aim is to supply builders with a streamlined solution to:
- Observe occasions server-side utilizing the Pinterest Conversion API
- Arrange client-side monitoring with the Pinterest Conversion Tag
- Validate occasions in take a look at environments, serving to to make sure accuracy earlier than manufacturing deployment
- Provide clear, reusable interfaces that builders can combine into their initiatives with minimal effort.
This package deal allows server-side occasion monitoring utilizing Pinterest’s Conversion API. Ultimate for back-end builders, it helps superior use instances like hashed consumer information and exact occasion attribution.
npm set up pinterest-conversions-server
npm set up pinterest-conversions-server
- Server-side occasion monitoring utilizing Pinterest API
- Specific server integration for dealing with API endpoints
- Assist for take a look at occasions to validate implementation
a. Initialize the API Shopper
import { PinterestConversionsAPI } from "pinterest-conversions-server";
const conversionsAPI = new PinterestConversionsAPI("");
b. Observe an Occasion
const information = {
event_name: "buy",
action_source: "internet",
event_time: Math.flooring(Date.now() / 1000),
user_data: {
external_id: [""],
em: [""],
},
};
const response = await conversionsAPI.trackEvent("", information);
c. Set Up an API Server
import { PinterestConversionsServer } from "pinterest-conversions-server";
new PinterestConversionsServer("", "").startPinterestApiServer(3000);
This package deal simplifies client-side monitoring with the Pinterest Tag. It’s excellent for monitoring occasions straight from the browser.
npm set up pinterest-conversions-client
- Shopper-side monitoring by way of Pinterest Tag
- Straightforward integration for internet purposes
- Assist for take a look at occasions to validate information
a. Initialize the Pinterest Tag
import { PinterestTag } from "pinterest-conversions-client";
const pinterestTag = new PinterestTag("");
b. Observe an Occasion
pinterestTag.monitor("custom_event", {
product_id: "12345",
worth: 100,
});
Each packages are designed with testing in thoughts:
- Use mock information to check server-side occasions in improvement environments
- Validate client-side occasions with take a look at mode enabled in Pinterest
{
"event_name": "buy",
"action_source": "internet",
"event_time": 1609459200,
"user_data": {
"em": ["hashed_email"],
"external_id": ["hashed_id"]
}
}
When utilizing these packages, guarantee all delicate information, like e mail addresses, is correctly hashed, and make sure that you clearly disclose and get any legally-required consent for the gathering, sharing and use (together with use by Pinterest) of the info you’re sharing as set forth in our Advert Information Phrases. Moreover, configure CORS settings if deploying the server package deal in a multi-origin setting.
Each packages are open supply and out there underneath the MIT license. We welcome contributions and suggestions from the developer neighborhood.
Monitoring conversions shouldn’t be a problem. With pinterest-conversions-server and pinterest-conversions-client, you’ll be able to shortly combine Pinterest’s highly effective monitoring instruments into your initiatives. Begin monitoring, optimize your campaigns, and assist enhance your ROI with ease.
To study extra about engineering at Pinterest, take a look at the remainder of our Engineering Weblog and go to our Pinterest Labs web site. To discover and apply to open roles, go to our Careers web page.