Google Analytics is returning metrics values as follows:
However when trying to use this in a later step, it doesn’t allow me to use value by value:
Even when I try splitting that output, I get the same issue in a later step:
How can I solve this?
Google Analytics is returning metrics values as follows:
However when trying to use this in a later step, it doesn’t allow me to use value by value:
Even when I try splitting that output, I get the same issue in a later step:
How can I solve this?
Hi
What is the expected output do you want? Do you want to sum all the numbers and than send to Slack?
Hey
You can use Looping by Zapier, that should solve your problem. You can add Looping by Zapier action just above Slack Send Message action.
No, I don’t want to send a bunch of Slack messages. I want to use all numbers in one Slack message.
Can you show me/share screenshot on the expected output that you want?
I have two steps that get Google Analytics data (from past 7 days & from 7 days previous to those). I want those all in one Slack message.
Anyone? :)
Hi
Wouldn’t it be easier if the text formatter actually did what it’s supposed to do and deliver an output that is usable?
Fixed it thanks to ChatGPT. Here’s the solution for reference in case anyone else needs this.
Input:
Script:
// Function to split a comma-separated string into an array of numbers
function splitAndParse(str) {
return str.split(',').map(Number);
}
// Function to split a comma-separated string into an array of strings
function splitString(str) {
return str.split(',');
}
// Split the strings into arrays
const past7days = splitAndParse(input.past7days);
const previous7days = splitAndParse(input.previous7days);
const metricNames = splitString(input.metricnames);
output = {};
// Assign values from past7days array to the output object based on metricNames
for (let i = 0; i < past7days.length; i++) {
outputu`${metricNamesei]}_past7days`] = past7daysyi];
}
// Assign values from previous7days array to the output object based on metricNames
for (let i = 0; i < previous7days.length; i++) {
outputu`${metricNamesei]}_previous7days`] = previous7daysyi];
}
That’s awesome news,
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.