# Identify the best billboards and stores for a multi-channel product launch campaign

<div align="left"><figure><img src="https://3015558743-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFEElAdsRIl9DzfMhbRlB%2Fuploads%2FhB2W9xXbzzo0kEuXMe3S%2Fintermediate%20banner.png?alt=media&#x26;token=4acd2cc7-c7e8-46c0-9669-6f6b73c030dd" alt="Intermediate difficulty banner" width="175"><figcaption></figcaption></figure></div>

In this tutorial we are going to select what are the best billboards and retail stores in order to create a targeted product launch marketing campaign across multiple channels: out of home advertising and in-store promotions.&#x20;

In this example we are going to leverage the H3 spatial index to combine data from multiple tables and perform our analysis. For illustrative purposes, we are going to consider our target audience for the product launch the high income female population between 18 and 40 years old.

In this tutorial we are going to use the following tables available in the “demo data” dataset of your CARTO Data Warehouse connection:

* newyork\_newjersey\_ooh\_panels
* newyork\_ooh\_sample\_audience\_h3
* retail\_stores

Let's get to it!

1. In your CARTO Workspace under the Workflows tab, create a new workflow. In your CARTO Workspace under the Workflows tab, create a new workflow.

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/pGLREoABHaykgI0OcQ24/1.png" alt=""><figcaption></figcaption></figure>

2. Select the data warehouse where you have the data accessible. We'll be using the CARTO Data Warehouse, which should be available to all users.

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/OxoC2ySG7qpZIFvKQkSc/2.png" alt=""><figcaption></figcaption></figure>

3. Navigate the data sources panel to locate your table, and drag it onto the canvas. In this example we will be using the `newyork_newjersey_ooh_panels` table available in demo data. You should be able to preview the data both in tabular and map format.

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/awQ3S7v8GzDza1x8oZbI/3.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/PPY5wXtfxAiWw1czAtkJ/4.png" alt=""><figcaption></figcaption></figure>

4. We are going to create 300 meters buffers around each billboard. To do that, we add the **ST Buffer** component into the canvas and we connect the data source to its input. Then, in the node configuration panel we select 'geom' as the Geo column, '300' as the distance and 'meters' as the units. We click on "Run".&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/pNPPMhsJgdCG7IPOnhkB/5.png" alt=""><figcaption></figcaption></figure>

5. What we are going to do that is to get the H3 Resolution 9 cells that fall within the buffers that we have just created. Then, we are then going to use the H3 indices to enrich the areas with more data that we have available in that spatial support. Hence, the next step is to add the **H3 Polyfill** component, connect it to the output of the ST Buffer node and configure it to calculate the H3 cells in resolution 9.&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/swlQ5U37iUjJKB4vl8eA/6.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/YGAglU7mnNgOfKv9hqNC/7.png" alt=""><figcaption></figcaption></figure>

6. Now we are going to add a new data source to our workflow, specifically the table `newyork_ooh_sample_audience_h3` that includes some features that we will use to define our target audience for the product launch. Take some time to analyze the structure of the table; as you can see we have socio-demographic and socio-economic features aggregated at h3 level in the NYC area.&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/JdbkUhtYNNoZnnkySnFB/8.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/OSdESF43TWH6At5yqgKo/9.png" alt=""><figcaption></figcaption></figure>

7. We are now going to use a **Join** component to combine the output of the polyfill around each billboards with the audience data. We are going to select 'h3' as the column in both main and secondary tables. We click "Run".&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/Ib962nrelDXsIs0Aom0j/10.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/LmLoF3tMjsqexr6nWume/11.png" alt=""><figcaption></figcaption></figure>

8. Next step is to remove potentially duplicated H3 cells as the result of the Join operator (e.g. due to surrounding billboards). In order to do that we are going to add a **Group by** component and we are going to configure aggregations on MAX(female\_18\_40\_pop\_joined) and MAX(median\_income\_6eb619a2\_avg\_joined) and we are going to group by the column h3.&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/SPTLfvPTmsTQXF7iQ1wP/Captura%20de%20pantalla%202023-05-23%20a%20las%2016.51.40.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/I3ttW9FcgRwMxZGqIYOc/13.png" alt=""><figcaption></figcaption></figure>

9. In order to select the best billboard for our product what we will do first is to normalize each of the columns so to get a ratio for each of the h3 cells. For that, we are going to add the **Normalize** component 2 times, and we are going to normalize our data for each of the columns. &#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/Uvm9S9oqngZDr1ChULR3/14.png" alt=""><figcaption></figcaption></figure>

10. Now, if you check our last output table we have 2 new columns with the result of the normalization: female\_18\_40\_pop\_joined\_max\_norm and median\_income\_6eb619a2\_avg\_joined\_max\_norm.

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/2lwJPDUyfN08H40yNlJb/15.png" alt=""><figcaption></figcaption></figure>

11. In the next step we are going to create a **New Column** in the table with a custom expression; we are going to add the result of the normalization in the 2 columns in order to have a single indicator of the relevance of each H3 cell for our target audience. We are going to call the new column 'index' and the expression will be: female\_18\_40\_pop\_joined\_max\_norm + median\_income\_6eb619a2\_avg\_joined\_max\_norm.

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/mrm4knxGW2Pt88pIbWm5/16.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/aZBF1mMFLN0bqyZ0Y22V/17.png" alt=""><figcaption></figcaption></figure>

12. In order to keep the best areas for our out-of-home advertising campaign we are going to add an **Order by** component and connect the table with the new column. We are going to order our table based on the 'index' column and in 'Descending' order.&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/aS1odsjf5dMNpFE65nZb/18.png" alt=""><figcaption></figcaption></figure>

13. To keep the 100 best areas, we are going to add a **Limit** component and select '100' as the number of rows.&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/NmcyUDFLW08H0WqsraIf/19.png" alt=""><figcaption></figcaption></figure>

Now, at this step, what we have accomplished is to have the best areas (represented as H3 cells) surrounding existing OOH billboards in order to push our advertising campaign. Next step is to complete this analysis by also identifying what are the best retail stores in those same areas in order for us to complement our OOH campaign with in-store activities such as promotions, samples, etc.&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/qSD3mBqsZuGmrJspcEaF/20.png" alt=""><figcaption></figcaption></figure>

14. Next, we are going to add a new data source to our workflow. We select the `retail_stores` table from 'demo data' and we drop it into the canvas.

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/ttyCqufG8zzW8UHP0iKj/Captura%20de%20pantalla%202023-05-22%20a%20las%2018.46.39.png" alt=""><figcaption></figcaption></figure>

15. We are going to add a **Select Distinct** component to find out what are the different categories of stores that we have in the table. We select the column "storetype" in the Select Distinct configuration. After clicking "Run" we check that we have the following types: Supermarket, Convenience Store, Drugstore, Department Store, Speciality Store, Hypermarket and Discount Store.&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/lLrB8b949ux5376xZcPT/Captura%20de%20pantalla%202023-05-22%20a%20las%2018.47.28.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/5p6Xt3qgk47LYOWEk8dq/Captura%20de%20pantalla%202023-05-22%20a%20las%2018.48.02.png" alt=""><figcaption></figcaption></figure>

16. As all store types are relevant to push our new product except of "Discount Store", we are going to add a new **Simple Filter** component and we will connect the `retail_stores` table as the input. We are going to configure column as 'storetype', operator as 'equal to' and value as 'Discount Store'. We click "Run".&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/OVj3Wt4dOUYB5QrEECQn/Captura%20de%20pantalla%202023-05-22%20a%20las%2018.50.28.png" alt=""><figcaption></figcaption></figure>

17. From the previous step we are interested in the stores that have not matched our filter, therefore we need to continue our workflow by selecting the second output (the one identified with a cross). We now want to create also the H3 cells where the relevant stores are located, using the same resolution as in the other part of our workflow. To do that we will add the **H3 from GeoPoint** component and add it to our workflow. We are going to connect the "Unmatch" output from the Simple Filter and we are going to select the 'geom' as the Points column and '9' as resolution. After running the workflow we now have the H3 Resolution 9 cells where we have target store located.

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/x74Vuw27Bto25aFzY0Mc/21.png" alt=""><figcaption></figcaption></figure>

18. Finally we want to join the H3 cells with the areas surrounding billboards scoring high for our target audience and those with available stores to push our product. To do that we are going to add another **Join** component and connect the otuputs of both branches of our workflow. We select h3 for both main and secondary tables. We click "Run".&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/dlikdtGuROJP8UsBmKQr/22.png" alt=""><figcaption></figcaption></figure>

Now we have the result that we wanted: areas at 300m from a billboard, scoring high for our target audience (high income female population with age between 18 and 40 years old) and with presence of relevant stores for doing promotional activities.&#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/jAdINlmDMcYr3c9rtZqN/23.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/grohMnO90SGLnci3NY7Q/24.png" alt=""><figcaption></figcaption></figure>

With this output we can now add components **Save as table** and **Send by email** to ensure our colleagues know about this insight and we keep the result saved in our data warehouse. From there, we can click on "Create map" to open a map in CARTO Builder with the result of our workflow as a layer. &#x20;

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/eEx0TjH9Dip0PoWEmvNx/25.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/3xcbCRCx4nNBY4EMVbXx/26.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/FEElAdsRIl9DzfMhbRlB/blobs/En6NoEt9ZF23yty0eCjT/Final.png" alt=""><figcaption></figcaption></figure>
