Organizations today rely on social media marketing more than any other form of marketing to acquire customers. Beyond the top social networks like Facebook, Twitter, etc., other social media websites are created based on the concept of sharing ideas. Pinterest is a top social website designed to encourage people to share ideas and monetize them.

Organizations that advertise on Pinterest often wish to analyze how users interact with their collaterals. Pinterest exposes this data through its APIs and provides basic analytics functionalities through its admin interface. But nothing can beat the convenience of having all the analytics data in one place and processing them with the help of your favorite data warehouse.

This article is about how to connect Pinterest Ads to Snowflake – A completely managed cloud-based data warehouse. 

Prerequisites

  • Pinterest Business Account
  • Snowflake User Account
  • Python 3.6 or above.

What are Pinterest Ads?

pinterest ads to snowflake: pinterest ads logo
Image Source

Pinterest is a platform that enables the discovery and saving of ideas using images, GIFs, and small duration videos. Pinterest calls these assets pins. Pinterest provides support for publishing commercial advertisements and marketing your brands through its platform. A simple and intuitive user interface without the typical distractions of a social website makes it a favorite among people who want to try different things on their own and share them with others. 

Pinterest provides basic analytics through its account analytics dashboard. It allows one to see how the users interact with your pins. Pinterest exposes this data through Pinterest APIs for analytics. It exposes metrics like impressions, save-events, outbound clicks, video views, watches- times, etc for a specific pin. It also provides metrics on a user account level, top pins, and top video pins. You will be using the Analytics API V5 to manually connect Pinterest Ads to Snowflake.

Key Features of Pinterest Ads

  • Gain Brand Awareness: Advertisements on Pinterest are an effective method for raising online brand awareness and recognition.
  • Increase Your Reach, Traffic, and Sales: If you use images of high quality within Pinterest search, you’ll be able to attract more visitors to your websites and landing pages, which will ultimately lead to an increase in sales, brand awareness, and traffic. 
  • Pinterest Search: The fact that content that has been shared on Pinterest can be located again and again through keywords, interests, and boards raises the possibility that it will drive traffic to your company over the long term.

What is Snowflake?

pinterest ads to snowflake: snowflake logo
Image Source

Snowflake is a completely managed data warehouse service that can be used over the web. Snowflake provides a unique pricing mechanism that separates storage costs and processing costs. Snowflake supports multiple clouds and hence is a favorite among organizations that do not want to lock in with a single vendor. Snowflake can execute queries in lightning-quick time. It supports JSON format and querying them through standard SQL. 

Snowflake can be used as a data warehouse, a data lake, a lakehouse, or even as a unistore. A unistore is a database that can be used for both transactional and analytical workloads. Snowflake’s unistore can enforce primary keys, unique constraints, and referential integrity. It also supports indexes for accelerated lookups. Snowflake also supports data science and machine learning use cases. The concept of the virtual warehouse in Snowflake allows it to share data with other user accounts and easier copying of data. 

Key Features of Snowflake

  • Snowflake enables you to enhance your Analytics Pipeline by transitioning from nightly Batch Loads to Real-time Data Streams, allowing you to improve the quality and speed of your analytics. By enabling Secure, Concurrent, and Monitoring Access to your Data Warehouse across your organization, you can improve the quality of analytics at your company.
  • Snowflake uses the Caching Paradigm to deliver the results from the cache swiftly. To avoid re-generating the report when nothing has changed, Snowflake employs Persistent (within the session) Query results.
  • Snowflake allows you to get rid of silos and ensure access to meaningful insights across the enterprise, resulting in better Data-driven Decision-Making. This is a crucial first step toward bettering partner relationships, optimizing pricing, lowering operational expenses, increasing sales effectiveness, and more.

Why Integrate Pinterest Ads to Snowflake?

Pinterest Ads helps identify different target audiences, selling platforms, payment gateways, inventory, and logistical channels. It’s also important to target people who have interacted with prior marketing efforts like email, SMS, and social media marketing. So it is necessary to download, examine, and compare distinct data silos from different selling platforms, payment gateways, and marketing tools.

To improve audience targeting, audience profiling data from e-commerce platforms, CRMs, and customer support systems must be analyzed. It is nearly impossible to gather all of the data from various platforms for each country separately, analyze it all, add the expense data, and then calculate overall profits or losses. It makes the analysis less accurate and less useful because the data is not analyzed in real-time. If done manually, compiling and processing data from various sources for in-depth research is a significant challenge.

For these reasons, leading businesses combine all of their data from Pinterest Ads into Snowflake so they can quickly analyze the information and produce reports that help makes analysis easier and more accurate.

Reliably integrate data with Hevo’s Fully Automated No Code Data Pipeline

If yours is anything like the 1000+ data-driven companies that use Hevo, more than 70% of the business apps you use are SaaS applications. Integrating the data from these sources in a timely way is crucial to fuel analytics and the decisions that are taken from it. But given how fast API endpoints etc can change, creating and managing these pipelines can be a soul-sucking exercise.

Hevo’s no-code data pipeline platform lets you connect over 150+ sources in a matter of minutes to deliver data in near real-time to your warehouse. What’s more, the in-built transformation capabilities and the intuitive UI means even non-engineers can set up pipelines and achieve analytics-ready data in minutes. 

All of this combined with transparent pricing and 24×7 support makes us the most loved data pipeline software in terms of user reviews.

Take our 14-day free trial to experience a better way to manage data pipelines.

Get started for Free with Hevo!

Pinterest Ads to Snowflake Data Migration

Method 1: Using Hevo to Set Up Pinterest Ads to Snowflake

Pinterest ads to snowflake: Hevo Logo
Image Source

Hevo provides an Automated No-code Data Pipeline that helps you move your Pinterest Ads swiftly to Snowflake. Hevo is fully-managed and completely automates the process of not only loading data from your 150+ data sources(including 40+ free sources)but also enriching the data and transforming it into an analysis-ready form without having to write a single line of code. Its fault-tolerant architecture ensures that the data is handled securely and consistently with zero data loss.

Using Hevo, you can integrate Pinterest Ads with Snowflake in the following 2 steps:

  • Step 1: Configure Pinterest Ads as the Source in your Pipeline by following these steps:
    • Step 1.1: For your Pinterest Ads instance, get authenticated access credentials.
    • Step 1.2: In the Asset Palette, select PIPELINES.
    • Step 1.3: In the Pipelines List View, click + CREATE.
    • Step 1.4: Click + ADD PINTEREST ADS ACCOUNT on the Configure your Pinterest Ads account page.
pinterest ads to snowflake: configure pinterest ads account
Image Source
  • Step 1.5: Use your Pinterest Business account to log in.
pinterest ads to snowflake: log in to pinterest
Image Source
  • Step 1.6: To grant Hevo access to your Pinterest Ads data, click Continue.
pinterest ads to snowflake: hevo access
Image Source
  • Step 1.7: Enter the following information on the Configure your Pinterest Ads Source page:
    • Pipeline Name: A distinct name for the Pipeline that isn’t longer than 255 characters.
    • Select Accounts: The account(s) for Pinterest Ads whose data you want to import. You can pick several accounts for ads.
    • Breakdowns: The level of time detail you require for your report’s data. You could, for instance, divide the total clicks by week or month.
    • Historic Sync Duration: The amount of time that the historical data needs to be ingested. 6 Months is the standard value.
pinterest ads to snowflake: configure pinterest ads as source
Image Source
  • Step 1.8: Simply press TEST & CONTINUE.
  • Step 1.9: Configure the data ingestion and establish the destination after that.
  • Step 2: To set up Snowflake as a destination in Hevo, follow these steps:
    • Step 2.1: In the Asset Palette, select DESTINATIONS.
    • Step 2.2: In the Destinations List View, click + CREATE.
    • Step 2.3: Select Snowflake from the Add Destination page.
    • Step 2.4: Set the following parameters on the Configure your Snowflake Destination page:
      • Destination Name: A unique name for your Destination.
      • Snowflake Account URL: This is the account URL that you retrieved.
      • Database User: The Hevo user that you created in the database. In the Snowflake database, this user has a non-administrative role.
      • Database Password: The password of the user.
      • Database Name: The name of the Destination database where data will be loaded.
      • Database Schema: The name of the Destination database schema. Default value: public.
      • Warehouse: SQL queries and DML operations are performed in the Snowflake warehouse associated with your database.
pinterest ads to snowflake: configure snowflake as destination
Image Source
  • Step 2.5: Click Test Connection to test connectivity with the Snowflake warehouse.
  • Step 2.6: Once the test is successful, click SAVE DESTINATION.
Solve your data replication problems with Hevo’s reliable, no-code, automated pipelines with 150+ connectors.
Get your free trial right away!

Method 2: Using Custom Code to Move Data from Pinterest Ads to Snowflake

To loading Data From Pinterest Ads to Snowflake, you will use Pinterest Analytics Python API to retrieve data from Pinterest. The JSON data will then be uploaded to Snowflake through the web interface. 

  • Step 1: The first step to connect Pinterest Ads to Snowflake is to gain access to Pinterest Analytics API. This can be done from the developer console available here. Log in with your business account and create an App. After the approval process, you will receive an Application ID and secret that can be used for accessing the Analytics API.
  • Step 2: Clone the official Pinterest API Repository here to start accessing the APIs. Execute the below command to do this.
git clone https://github.com/pinterest/api-quickstart.git
  • Step 3: From the top-level directory of the cloned repository, type the below commands to configure the Application ID and secret.
$ cd common/scripts
$ cp api_app_credentials.template api_app_credentials
  • Step 4: Edit the api_app_credentials file to add the Application ID and secret.
  • Step 5: Now initiate a Python script and configure the below import statements.
import argparse
import json
import sys
from os.path import abspath, dirname, join

sys.path.append(abspath(join(dirname(__file__), "..", "src")))

from api_config import ApiConfig
from arguments import common_arguments
from utils import input_number, input_path_for_write
from access_token import AccessTokenfrom advertisers import Advertisersfrom analytics import AdAnalytics, PinAnalytics, UserAnalyticsfrom oauth_scope import Scopefrom user import User
  • Step 6: Use the below snippet to fetch the access token.
access_token = AccessToken(api_config, name=args.access_token)
    scopes = [Scope.READ_USERS]
    scopes += [Scope.READ_ADVERTISERS]
    access_token.fetch(scopes=scopes)
  • Step 7: Use the below snippet to get metrics about your pin.
analytics = (
            PinAnalytics(“<Your_pin_id”, api_config, access_token)
            .last_30_days()
            .metrics({"IMPRESSION", "PIN_CLICK"})   results = analytics.get() 

Ensure to change the pin ID in the above snippet to the one you want to fetch analytics information.

  • Step 8: Write the results to a JSON file using the below snippet.
with open(“Path_to_json_file”, "w") as json_file:
        json.dump(results, json_file, indent=2)

Ensure that you add the correct path where you want the JSON file to be saved in the above snippet.

  • Step 9: Save the completed script file and execute the script to get the JSON file. 
  • Step 10: You will not upload the JSON file to a Snowflake table. Since Snowflake supports JSON loading and querying, you can use a single-column Snowflake table to load our raw JSON file. For this, first, head to the Snowflake Web Console and create a table with the below Query.
CREATE TABLE METRICS_JSON (RAW_JSON VARIANT);
  • Step 11: Once the table is created, head to the databases section in Snowflake and click ‘Load Data’.
Pinterest ads to snowflake: metrics json
Image Source: Self
  • Step 12: Select the JSON file that you have generated using the Python Script and click Next.
Pinterest ads to snowflake: load data
Image Source: Self

If everything is well, you should now see the data reflected in your Snowflake database. 

That completes the sequence for loading data from Pinterest Ads to Snowflake. Even though you successfully loaded the data, it required us to develop quite a bit of code.

Limitations of Manually Connecting Pinterest Ads to Snowflake

The Limitations of Manually Connecting Pinterest Ads to Snowflake are:

  • This method of Pinterest Ads to Snowflake integration uses synchronous APIs from Pinterest. While this is fine for smaller amounts of data, it is not a good approach for larger data volumes.  The use of an asynchronous API will further complicate the code.
  • This approach of connecting Pinterest Ads to Snowflake is suitable for a one-time load. In reality, there will be period loads and these loads have to be managed by an automated module.
  • In most cases, the data has to be processed and transformed before loading into data warehouses. This is not addressed here.

Conclusion

Pinterest is an idea-sharing social network that is a great alternative for building a brand. Marketing teams usually want to keep track of every activity of the user while they build brands. This article detailed the approach to loading the user activity data from Pinterest Ads to Snowflake. This helps marketing teams to analyze the Pinterest engagement data in a proper data warehouse without having to depend only on the default analytics dashboard provided. In case you are looking for a no-code approach to solve this problem, you should check Hevo.

Visit our Website to Explore Hevo

Hevo offers a No-code Data Pipeline that can automate your data transfer process, hence allowing you to focus on other aspects of your business like Analytics, Marketing, Customer Management, etc.

This platform allows you to transfer data from 150+ sources (including 40+ Free Sources) such as Pinterest Ads and Cloud-based Data Warehouses like Snowflake, Google BigQuery, etc. It will provide you with a hassle-free experience and make your work life much easier.

Want to take Hevo for a spin? 

Sign Up for a 14-day free trial and experience the feature-rich Hevo suite firsthand. You can also have a look at the unbeatable pricing that will help you choose the right plan for your business needs.

Talha
Software Developer, Hevo Data

Talha is a Software Developer with over eight years of experience in the field. He is currently driving advancements in data integration at Hevo Data, where he has been instrumental in shaping a cutting-edge data integration platform for the past four years. Prior to this, he spent 4 years at Flipkart, where he played a key role in projects related to their data integration capabilities. Talha loves to explain complex information related to data engineering to his peers through writing. He has written many blogs related to data integration, data management aspects, and key challenges data practitioners face.

No-code Data Pipeline For Snowflake