I wanted to deviate a bit from my usual blog post because I find this topic so interesting. After the chaos created from the DeepSeek news, I wanted to compare the outputs of a few AI chatbots.
One of my clients had requested a daily email of the last 7 days of sales from Google Ads. Recently, they asked me to add ROAS to the email. I know a bit of programming, but not enough to #1 create a script completely from scratch and #2 know how to pull the Google Ads metrics into the script. So, I typically turn to ChatGPT for my programming questions.
I entered the following prompt and code into ChatGPT:
I have the following script. How do I add ROAS?
function main() {
// Email to send the report
var email = "april@griffithx.com";
// Define the time range
var timeRange = "LAST_7_DAYS";
// Create a report to gather the required data
var report = AdsApp.report(
"SELECT CampaignName, Conversions, ConversionValue " +
"FROM CAMPAIGN_PERFORMANCE_REPORT " +
"WHERE Impressions > 0 " +
"DURING " + timeRange
);
// Prepare the email content
var emailSubject = "Google Ads Conversions";
var emailBody = "Here is the conversion value for each campaign over the last 7 days:\n\n";
var rows = report.rows();
while (rows.hasNext()) {
var row = rows.next();
var campaignName = row["CampaignName"];
var conversions = Math.floor(parseFloat(row["Conversions"]));
var conversionValue = row["ConversionValue"];
emailBody += "Campaign: " + campaignName + "\n";
emailBody += "Conversions: " + conversions + "\n";
emailBody += "Conversion Value: " + conversionValue + "\n\n";
}
// Check if there's data to send
if (emailBody === "Here is the conversion value for each campaign over the last 7 days:\n\n") {
emailBody += "No data available for the selected time period.";
}
// Send the email
MailApp.sendEmail(email, emailSubject, emailBody);
Logger.log("Email sent successfully.");
}
Below is the output from ChatGPT and DeepSeek, side-by-side so you can see the striking similarities.
ChatGPT Output
To add ROAS (Return on Ad Spend) to your script, you need to include Cost in the report and then calculate ROAS using the formula:
Here’s how you can modify your script to include ROAS:
Modified Script with ROAS
function main() {
// Email to send the report
var email = "april@griffithx.com";// Define the time range
var timeRange = "LAST_7_DAYS";
// Create a report to gather the required data
var report = AdsApp.report(
"SELECT CampaignName, Conversions, ConversionValue, Cost " +
"FROM CAMPAIGN_PERFORMANCE_REPORT " +
"WHERE Impressions > 0 " +
"DURING " + timeRange
);
// Prepare the email content
var emailSubject = "Google Ads Conversions and ROAS";
var emailBody = "Here is the conversion value and ROAS for each campaign over the last 7 days:\n\n";
var rows = report.rows();
while (rows.hasNext()) {
var row = rows.next();
var campaignName = row["CampaignName"];
var conversions = Math.floor(parseFloat(row["Conversions"]));
var conversionValue = parseFloat(row["ConversionValue"]);
var cost = parseFloat(row["Cost"]);
// Calculate ROAS
var roas = cost > 0 ? (conversionValue / cost).toFixed(2) : "N/A";
emailBody += "Campaign: " + campaignName + "\n";
emailBody += "Conversions: " + conversions + "\n";
emailBody += "Conversion Value: " + conversionValue + "\n";
emailBody += "Cost: " + cost.toFixed(2) + "\n";
emailBody += "ROAS: " + roas + "\n\n";
}
// Check if there's data to send
if (emailBody === "Here is the conversion value and ROAS for each campaign over the last 7 days:\n\n") {
emailBody += "No data available for the selected time period.";
}
// Send the email
MailApp.sendEmail(email, emailSubject, emailBody);
Logger.log("Email sent successfully.");
}Explanation of Changes:
- Updated Query:
- Added
Costto theSELECTstatement.
- Added
- ROAS Calculation:
- Checked if
Costis greater than 0 to avoid division by zero. - If
Cost > 0, calculated ROAS asConversionValue / Cost. - Displayed “N/A” if the cost is zero.
- Checked if
- Enhanced Email Body:
- Included
CostandROASin the email content.
- Included
Now, the email will show campaign performance, including conversions, conversion value, cost, and ROAS.
DeepSeek Output
To add ROAS (Return on Ad Spend) to your script, you need to include the Cost metric in your report query. ROAS is calculated as:
- Add
Costto the report query. - Calculate ROAS for each campaign.
- Include ROAS in the email body.
Modified Script with ROAS
function main() {
// Email to send the report
var email = "april@griffithx.com";// Define the time range
var timeRange = "LAST_7_DAYS";
// Create a report to gather the required data
var report = AdsApp.report(
"SELECT CampaignName, Conversions, ConversionValue, Cost " +
"FROM CAMPAIGN_PERFORMANCE_REPORT " +
"WHERE Impressions > 0 " +
"DURING " + timeRange
);
// Prepare the email content
var emailSubject = "Google Ads Conversions and ROAS";
var emailBody = "Here is the conversion value and ROAS for each campaign over the last 7 days:\n\n";
var rows = report.rows();
while (rows.hasNext()) {
var row = rows.next();
var campaignName = row["CampaignName"];
var conversions = Math.floor(parseFloat(row["Conversions"]));
var conversionValue = parseFloat(row["ConversionValue"]);
var cost = parseFloat(row["Cost"]);
// Calculate ROAS
var roas = cost > 0 ? (conversionValue / cost).toFixed(2) : "N/A";
emailBody += "Campaign: " + campaignName + "\n";
emailBody += "Conversions: " + conversions + "\n";
emailBody += "Conversion Value: " + conversionValue + "\n";
emailBody += "Cost: " + cost.toFixed(2) + "\n";
emailBody += "ROAS: " + roas + "\n\n";
}
// Check if there's data to send
if (emailBody === "Here is the conversion value and ROAS for each campaign over the last 7 days:\n\n") {
emailBody += "No data available for the selected time period.";
}
// Send the email
MailApp.sendEmail(email, emailSubject, emailBody);
Logger.log("Email sent successfully.");
}
Explanation of Changes:
- Updated Query:
- Added
Costto theSELECTstatement.
- Added
- ROAS Calculation:
- Checked if
Costis greater than 0 to avoid division by zero. - If
Cost > 0, calculated ROAS asConversionValue / Cost. - Displayed “N/A” if the cost is zero.
- Checked if
- Enhanced Email Body:
- Included
CostandROASin the email content.
- Included
You don’t need to look very closely to see that the outputs between ChatGPT and DeepSeek are nearly identical. Crazy, right? Since DeepSeek is reportedly built on the same LLM architecture as ChatGPT, perhaps that’s part of the reason.
However, there was a catch: both chatbots returned incorrect code. When I ran the script, it threw an error. I prompted both AI models with the same error message, and this time, their responses were slightly (very slightly) different.
That said, given the fact that DeepSeek gives incorrect information if the truth doesn’t align with *cough* particular narratives, I’m going to stick with ChatGPT. For me, there’s no cost difference.
