Google Tag Manager

Forum Discussion

kvarley's avatar
kvarley
Collaborator
2 months ago

Detect channel in Content block (push vs email)

Is there a reliable way in Liquid to detect whether a content block is being used in a push message vs. an email message?  I know there are some global specific to each channel but I'm curious about the most reliable/supported way to do this in liquid.

2 Replies

  • Hi,

    There isn’t a direct method to detect the delivery channel from within a shared content block.

    However, a practical workaround is to follow a naming convention for the message step that includes the channel (e.g., "Welcome Email", "Promo Push", etc.).

    You can then retrieve the message step name inside the content block using below personalization snippets.

    {{campaign.${name}}}
    {{campaign.${message_name}}}

    Based on this name, you can implement conditional logic to tailor the content accordingly.

    Once deployed, the shared content block automatically adapts its behavior depending on the delivery channel of the message it's embedded in, as long as your logic is set up based on the naming pattern.

     

    Check "Canvas Step Attributes" on https://www.braze.com/docs/user_guide/personalization_and_dynamic_content/liquid/supported_personalization_tags/#summary-of-supported-tags