How do I sum different attributs from different bundles and store the output in the original attribute name so they can sum only the same values from each bundle

Hi to all,

I’m trying to make a scenerio which can fetch the statistics from google ads.

My goal is to sum the 6 attributs I’m looking for (impression, clicks, calls and so on) given by 2 bundles so I would keep the original name and calculate the SUM for that attribute only (e.g. Impressions from 2 bundles is 6 & 8 so my output should be 14)

I tries several ilitrators and also tried to set multipal veriables to do so but I get the wrong results and cannot fetch those (the sum of those different 6 attributs) at the end of the scenario.

Eventually I want this information (Sum of Impression, Sum of Clicks and so on) will be written in a google sheet file (which I already opened)

Where to start, where to start. It is going to be difficult to help you without details on what the data looks like. But how about you do some training first on managing data structures so that maybe you can help yourself and understand how to access and manipulate various data structures.

What may help is if you breakdown your process into manageable steps and write them out rather than building a scenario first.

1 Like

Hi @Jecki_Shoef
If you can provide the output bundle from the ‘google ad’ module, we will be able to assist you more effectively.

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
| Book Live Implementation
Visit us here
Youtube Channel

2 Likes

Hi,

Thanks for trying to help.

I’ve attached the outcome.
The aim is to sum each attribute with from both bundles. So I’ll “Sum of impressions”, “Sum of clicks” and so on, so I can pass it in a single row to a spreadsheet (to validate the stats before sending to clients) .

I’ve thought of 3 ways for that, eighter sticking with the SUM function in make (if I can make sum function on those 2 bundles output, with new allias as I mentioned above), or maybe adding all attributes in a single row to spreadsheet (the 2 bundles stats, separated to different columns) and make the SUM function there. The last option for now is to move my data to airtable and make all functions there. Which one is the best?

Thanks in advnace

Thanks for the link,

I’ll try to make it simpler by this chart I made:

Thanks in advance

That helps a lot. Now can you share the output bundles from the Google Ads module and we can try to see if we can simulate this. I think the numeric aggregator can help us here!

Welcome to the Make community!

For further assistance, please provide the following:

(not screenshots)

Please provide the output bundles of the trigger module by running the scenario, then click the white speech bubble on the top-right of each module and select “Download output bundles”.
Screenshot_2023-10-06_141025

A.

Save the bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading it here will look like this:

bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted output bundle in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

samliewrequest private consultation

Join the unofficial Make Discord server to chat with us!

2 Likes

Hi,

I’ve attached the file below for the output, really hope that’ll help solving this issue.
make_output_bundles.txt (1.9 KB)

Thanks again in advance
Jecki

Hi @Jecki_Shoef
We created a json structure with the output bundle you provided. With the following workflow we were able to get the sum for each attributed from different bundles:

image

Output bundle of json structure:

Numeric aggregator for convertions:
image

Output:
image

Numeric aggregator for clicks :
image

Output:
image

Similarly you can use numeric aggregator for other attributes sum. Make sure that you use correct source module in the numeric aggregator.

2 Likes

Hi @Msquare_Automation ,

Thank you for answering.
I tried your way and it worked on SUM’s, but now I have problem passing the attributes to google sheet as a new row in a master file.
Here is a screenshot:

I can only connect one of the routs to my google sheet document, and cannot pass the values into 1 single row.

Thanks in advance
Jecki

And I must wonder if this is the best way as it will consume more operations for each cycle (=report).

Thanks

Welcome to the Make community!

Yes, that is possible. You’ll need a minimum of four modules (can be further reduced to 3):

You aggregate all the bundles from the Google Ads module first, then perform the sums using Set multiple variables module.

Output

Screenshot_2024-06-09_120639

Give it a go and let us know if you have any issues!

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block
    Screenshot_2024-01-17_200117

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

View Module Export Code

JSON

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 75,
                    "module": "json:ParseJSON",
                    "version": 1,
                    "parameters": {
                        "type": ""
                    },
                    "mapper": {
                        "json": "[\n  {\n    \"campaign\": {\n      \"resourceName\": \"customers/6481301907/campaigns/20484330172\",\n      \"status\": \"ENABLED\",\n      \"name\": \"Discloused Information\",\n      \"id\": \"20484330172\"\n    },\n    \"metrics\": {\n      \"clicks\": \"1098\",\n      \"conversions\": 660,\n      \"costMicros\": \"301643201\",\n      \"costPerConversion\": 457035.153030303,\n      \"ctr\": 0.0031145225249757475,\n      \"allConversions\": 1957,\n      \"allConversionsFromClickToCall\": 0,\n      \"allConversionsFromDirections\": 0,\n      \"allConversionsFromOtherEngagement\": 0,\n      \"averageCost\": 274720.58378870675,\n      \"averageCpc\": 274720.58378870675,\n      \"averageCpm\": 855623.4462844143,\n      \"impressions\": \"352542\",\n      \"phoneCalls\": \"8\",\n      \"phoneImpressions\": \"935\"\n    },\n    \"__IMTLENGTH__\": 2,\n    \"__IMTINDEX__\": 1\n  },\n  {\n    \"campaign\": {\n      \"resourceName\": \"customers/6481301907/campaigns/20485581784\",\n      \"status\": \"ENABLED\",\n      \"name\": \"Discloused Information\",\n      \"id\": \"20485581784\"\n    },\n    \"metrics\": {\n      \"clicks\": \"3509\",\n      \"conversions\": 818,\n      \"costMicros\": \"432883641\",\n      \"costPerConversion\": 529197.6051344743,\n      \"ctr\": 0.012041990823515685,\n      \"allConversions\": 2289,\n      \"allConversionsFromClickToCall\": 0,\n      \"allConversionsFromDirections\": 0,\n      \"allConversionsFromOtherEngagement\": 0,\n      \"averageCost\": 123363.81903676261,\n      \"averageCpc\": 123363.81903676261,\n      \"averageCpm\": 1485545.9767945448,\n      \"impressions\": \"291397\",\n      \"phoneCalls\": \"93\",\n      \"phoneImpressions\": \"18742\"\n    },\n    \"__IMTLENGTH__\": 2,\n    \"__IMTINDEX__\": 2\n  }\n]"
                    },
                    "metadata": {
                        "designer": {
                            "x": -105,
                            "y": -1746,
                            "name": "Google Ads Output"
                        },
                        "restore": {
                            "parameters": {
                                "type": {
                                    "label": "Choose a data structure"
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "type",
                                "type": "udt",
                                "label": "Data structure"
                            }
                        ],
                        "expect": [
                            {
                                "name": "json",
                                "type": "text",
                                "label": "JSON string",
                                "required": true
                            }
                        ]
                    }
                },
                {
                    "id": 76,
                    "module": "builtin:BasicAggregator",
                    "version": 1,
                    "parameters": {
                        "feeder": 75
                    },
                    "mapper": {
                        "campaign": "{{75.campaign}}",
                        "metrics": "{{75.metrics}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 137,
                            "y": -1747
                        },
                        "restore": {
                            "extra": {
                                "feeder": {
                                    "label": "JSON - Parse JSON [75]"
                                },
                                "target": {
                                    "label": "Custom"
                                }
                            }
                        }
                    }
                },
                {
                    "id": 77,
                    "module": "util:SetVariables",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "variables": [
                            {
                                "name": "Sum Of Clicks",
                                "value": "{{sum(map(76.array; \"metrics.clicks\"))}}"
                            },
                            {
                                "name": "Sum Of Conversions",
                                "value": "{{sum(map(76.array; \"metrics.conversions\"))}}"
                            },
                            {
                                "name": "Sum Of Impressions",
                                "value": "{{sum(map(76.array; \"metrics.impressions\"))}}"
                            },
                            {
                                "name": "Sum Of Phone Calls",
                                "value": "{{sum(map(76.array; \"metrics.phoneCalls\"))}}"
                            },
                            {
                                "name": "Sum Of Phone Impressions",
                                "value": "{{sum(map(76.array; \"metrics.phoneImpressions\"))}}"
                            }
                        ],
                        "scope": "roundtrip"
                    },
                    "metadata": {
                        "designer": {
                            "x": 381,
                            "y": -1751
                        },
                        "restore": {
                            "expect": {
                                "variables": {
                                    "items": [
                                        null,
                                        null,
                                        null,
                                        null,
                                        null
                                    ]
                                },
                                "scope": {
                                    "label": "One cycle"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "variables",
                                "type": "array",
                                "label": "Variables",
                                "spec": [
                                    {
                                        "name": "name",
                                        "label": "Variable name",
                                        "type": "text",
                                        "required": true
                                    },
                                    {
                                        "name": "value",
                                        "label": "Variable value",
                                        "type": "any"
                                    }
                                ]
                            },
                            {
                                "name": "scope",
                                "type": "select",
                                "label": "Variable lifetime",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "roundtrip",
                                        "execution"
                                    ]
                                }
                            }
                        ],
                        "interface": [
                            {
                                "name": "Sum Of Clicks",
                                "label": "Sum Of Clicks",
                                "type": "any"
                            },
                            {
                                "name": "Sum Of Conversions",
                                "label": "Sum Of Conversions",
                                "type": "any"
                            },
                            {
                                "name": "Sum Of Impressions",
                                "label": "Sum Of Impressions",
                                "type": "any"
                            },
                            {
                                "name": "Sum Of Phone Calls",
                                "label": "Sum Of Phone Calls",
                                "type": "any"
                            },
                            {
                                "name": "Sum Of Phone Impressions",
                                "label": "Sum Of Phone Impressions",
                                "type": "any"
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like

Hi,

I tried but I get an error:


The output looks like this:

When I tried manually enter the metrics.clicks istead of forwarding through the UI it came with an error.

What’s wrong?

The output for the array is following:

But when it sums than all goes to 0:

Hope to learn from this errors :slight_smile:

Thanks in advance

6d8f784d2c4a1e14ad25ea73fda4fb4a6d241f09

Please copy my screenshot exactly. You must manually type the raw values out.

If you don’t know how to do that, please copy-paste my module export.

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

2 Likes

You don’t have to use the router as the numeric aggregators can be placed in sequence one after the other, but I think @samliew 's approach is more concise using the sum() and map() formulas together.

1 Like

Here’s the Clicks sum expression – note how the raw metrics.clicks is the dot notation. You will need ot use @samliew blueprint if you want the other formulas or just adjust this one for the other key names in the metrics array.

@Jecki_Shoef I highly recommend my Make for Make Newbies video series to get you more comfortable with how data is referenced and manipulated in Make.


Alex Sirota
Director of NewPath Consulting - we are :superhero: Make Heroes! :woman_superhero:t4:

:heart_on_fire: Check out my series of videos and scenario walkthroughs for Make Newbies :heart_on_fire:

My Solutions on Make Community

1 Like

Thanks,

It fixed :slight_smile:
By the way, I watched your seriers (few episodes) and they were insightful, Great work for newbies like me, kudos.

Thank you also @samliew for your contribution.

Jecki

3 Likes

No problem, glad I could help!

1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

  • others can save time when catching up with the latest activity here, and
  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

4. Do join the unofficial Make Discord server for live chat and video assistance

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like