Skip to content

[Feature] Include additional title fields in ad history and allow custom ad_name #37

Closed
@JeremyDOwens

Description

@JeremyDOwens

Is there an existing feature request for this?

  • I have searched the existing issues

Describe the Feature

Background

stg_microsoft_ads__ad_history_tmp contains several columns that contain information related the ad, as is delivered from the initial report.

  • title_part_1
  • title_part_2
  • title_part_3
  • domain
  • type

Currently, get_ad_history_columns() only selects title_part_1 and type from that list

In many cases with this ad platform, title_part_1 is not a good differentiator and the better ad_name has been configured to fit in a different column. Additionally, when type = 'Responsive Search Ad' title_part_1 is always null.

Proposed feature

Allow users to configure how the ad_name is determined from any of the fields in the list.

How would you implement this feature?

CAVEAT: This is code I haven't tested, and all snippets are for discussion purposes

  1. Update get_ad_history_columns() to include additional columns
{% set columns = [
    {"name": "id", "datatype": dbt.type_int()},
    {"name": "title_part_1", "datatype": dbt.type_string()},
    {"name": "final_url", "datatype": dbt.type_string()},
    {"name": "ad_group_id", "datatype": dbt.type_int()},
    {"name": "modified_time", "datatype": dbt.type_timestamp()},
    {"name": "status", "datatype": dbt.type_string()},
    {"name": "type", "datatype": dbt.type_string()},
    {"name": "title_part_2", "datatype": dbt.type_string()},
    {"name": "title_part_3", "datatype": dbt.type_string()},
    {"name": "title", "datatype": dbt.type_string()},
    {"name": "domain", "datatype": dbt.type_string()}
] %}
  1. create a variable microsoft_ads_source__ad_name_selector with a default value of title_part_1
  2. Reference the ad name selector in stg_microsoft_ads__ad_history instead of explicitly referencing title_part_1
...
final as (

    select
        source_relation, 
        id as ad_id,
        {{ var.microsoft_ads_source__ad_name_selector }}  as ad_name,
        final_url,
        ad_group_id,
...

Describe alternatives you've considered

Alternative...

  1. Same as 1 above

  2. Create a new macro generate_ad_name() with a sensible default - title_part_1 so it's a non-breaking change

{% macro generate_ad_name() %}

    {{ return(adapter.dispatch('my_macro', 'microsoft_ads_source')()) }}

{% endmacro %}

{% macro default__generate_ad_name() %}

    title_part_1

{% endmacro %}
  1. Call this macro in stg_microsoft_ads__ad_history instead of explicitly referencing title_part_1
...
final as (

    select
        source_relation, 
        id as ad_id,
        {{ microsoft_ads_source.generate_ad_name}}  as ad_name,
        final_url,
        ad_group_id,
...

With this setup (or something similar), I think a user should then be able to override the macro.

Are you interested in contributing this feature?

  • Yes.
  • Yes, but I will need assistance.
  • No.

Anything else?

No response

Metadata

Metadata

Labels

type:enhancementNew functionality or enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions