Resources enabling generative AI-powered marketing use cases on Google Cloud.
This repository showcases the application of Google Cloud's Generative AI to marketing scenarios. It contains detailed, step-by-step instructions to deploy a solution implementing marketing-centric Generative AI capabilities, including capabilities to craft marketing materials like blog posts and social media content. This video walks through the functionality in the solution.
The architecture of the deployed solution:
Additionally, supplementary Jupyter notebooks are provided to aid users in grasping the concepts explored in the solution.
- Repository Structure
- Demonstrations
- Deployment
- Notebooks and Code Samples
- Configuration
- Getting Help
.
├── app
└── backend_apis
└── frontend
└── notebooks
└── templates
└── infra
/app
: Architecture diagrams and images./backend_apis
: Source code for backend APIs./frontend
: Source code for the frontend UI./infra
: Scripts and configuration for deploying the solution./notebooks
: Notebooks demonstrating and explaining how to use Google Cloud's Generative AI for marketing scenarios, including scenarios included in the solution./templates
: Workspace Slides, Docs and Sheets templates used in the solution.
The deployed solution supports the following demonstrations:
- Marketing Insights: Utilize Looker Dashboards to access and visualize marketing data. Marketers can access and visualize marketing data to build data-driven marketing campaigns, empowering businesses to connect with their target audience more efficiently, thereby improving conversion rates.
- Audience and Insight Finder: Conversational interface that translates natural language into SQL queries, democratizing access to data for non-SQL users thus removing bottlenecks for marketing teams.
- Trendspotting: Identify emerging trends in the market by analyzing Google Trends data on a Looker dashboard, and summarize news related to top search terms. This can help businesses to stay ahead of the competition and develop products and services that meet the needs and interests of their customers.
- Content Search: Improve search experience for internal or external content with Vertex AI Search for business users.
- Content Generation: Reduce time for content generation with Vertex Foundation Models. Generate compelling and captivating email copy, website articles, social media posts, and assets for PMax. All aimed at achieving specific goals such as boosting sales, generating leads, or enhancing brand awareness. This encompasses both textual and visual elements using Vertex language & vision models.
- Workspace Integration: Transfer the insights and assets you generate to Google Workspace, and visualize in Google Slides, Docs and Sheets.
Follow the instructions in the deployment guide to deploy with Terraform.
This video walks through the automated deployment process.
The notebooks listed below were developed to explain the concepts featured in this solution:
- Data Q&A with PaLM API and GoogleSQL (/notebooks/data_qa_with_sql.ipynb): Translate questions from natural language to GoogleSQL to interact with BigQuery.
- News Summarization with LangChain Agents and Vertex AI PaLM Text Models (news_summarization_langchain_palm.ipynb): Summarize news articles related to top search terms using LangChain agents and the ReAct concept.
- News Summarization with PaLM API (simple_news_summarization.ipynb): News summarization related to top search terms.
- Imagen Fine Tuning (Imagen_finetune.ipynb): Fine tune Imagen model.
The following additional (external) notebooks provide supplementary information on the concepts discussed in this repository:
- Tuning Gemini: Examples of how to tune Gemini with your dataset to improve the model's response. This is useful for brand voice because it allows you to ensure that the model is generating text that is consistent with your brand's tone and style.
- Document Summarization Techniques: Two notebooks explaining different techniques to summarize large documents.
- Document Q&A: Two notebooks explaining different techniques to do document Q&A on a large amount of documents.
- Vertex AI Search - Web Search: This demo illustrates how to search through a corpus of documents using Vertex AI Search. Additional features include how to search the public Cloud Knowledge Graph using the Enterprise Knowledge Graph API.
- Vertex AI Search - Document Search: This demo illustrates how Vertex AI Search and the Vertex AI PaLM API help ensure that generated content is grounded in validated, relevant and up-to-date information.
- Getting Started with LangChain and Vertex AI PaLM API: Getting Started with LangChain + Vertex AI Gemini API.
Some of the solution's behavior can be changed by adjusting configuration.
When deploying the Google Cloud Generative AI for Marketing solution, various settings for the deployment are pulled from the infra/variables.tf
file.
If your deployment needs do not match the default deployment, some of your deployment needs might be met by adjusting the defaults in variables.tf
prior to beginning deployment.
Make changes to variables.tf
prior to running terraform init
, making changes afterwards may result in unexpected behavior including irrecoverable deployment failures.
When deploying, after terraform apply
completes successfully, there will be a file called config.toml
in backend_apis/app
. config.toml
is generated from infra/templates/config.toml.tftpl
.
config.toml
acts as a control center for a marketing content generation, providing the necessary settings, prompts, and data to automate the creation of personalized and brand-consistent marketing materials.
You can adjust some of the values in config.toml
to change the behavior of your deployment. If you adjust the values in config.toml
, rerun the backend deployment (infra/scripts/backend_deployment.sh
) to push the updated config to the backend
The following are the key sections of config.toml
and their functions:
- Sets core project settings (project ID, location).
- Specifies credentials for Workspace access.
- Identifies BigQuery datasets and Vertex AI resources.
- Defines Workspace document templates and folders.
- Sets the GCS bucket for asset storage.
- Defines Workspace API scopes (permissions).
- Provides detailed brand information (name, vision, mission, etc.) to guide content generation.
- Defines prompt templates for various types of content (brand statement, primary message, communication channel, email, web post, ad, headlines, descriptions).
- Includes placeholders ({}) for dynamic content insertion.
- Specifies the names of AI models to use for text and image generation.
- Provides sample data and options (age buckets, names, languages) for personalizing content.
You can display your own Looker Dashboards in the Marketing Insights and Campaign Performance pages.
For Marketing Insights, edit /frontend/src/app/marketing-insights/marketing-insights.component.html and for Campaign Performance edit /frontend/src/app/marketing-insights/marketing-insights.component.html. The procedure is the same for both of these files:
- Find the line
<select class="select-theme-dropdowns" name="state" ngModel (ngModelChange)="onClick($event)">
. If you are on a fresh deployment, the line below is<option value="Overview">Overview</option>
. - Add another similarly formatted line:
<option value="Display Name in Dropdown">newdash</option>
, wherevalue
is what will be displayed in the UI and inside the>
and<
is the identifier you'll use below to link to the dashboard. In this case we're adding a dashboard that will be identified as "Display Name in Dropdown" and below we'll link this dashboard using thenewdash
identifier.
On a fresh deployment at the bottom of the file, you'll see something like this:
<div *ngIf="overview" class="overviewcss">
<iframe width="1000" height="1000" src="https://googledemo.looker.com/embed/dashboards/2131?allow_login_screen=true" ></iframe>
</div>
At the end of the file, add three similar lines for each dashboard, replacing the following:
- Set
*ngIF=
to the identifier of the new dashboard that you specified in the dropdown. E.g.<div *ngIf="newdash" class="overviewcss">
. - Set the
src=
to the embed link to your dashboard. Theallow_login_screen=true
in the URL will open the authentication page from Looker to secure the access to your account. E.g.,<iframe width="1000" height="1000" src="https://googledemo.looker.com/embed/dashboards/YOURDASH?allow_login_screen=true" ></iframe>
If you have your Google Ads and Google Analytics 4 accounts in production, you can deploy the Marketing Analytics Jumpstart
solution, build the Dashboards, and link them into these pages in the Generative AI for Marketing UI.
If you have any questions or if you found any problems with this repository, please report through GitHub issues.