Search code examples
jinja2moengage

MoEngage // On sending an email in MoEngage, need to hide some HTML block if user has clicked on a identified link on previows campaign


I've sent an email in MoEngage with 2 questions, like this:

  1. question 1...? a) answer has link 1a: link_a?utm_term=2024-06-28&user_id=&receitas=doces; b) answer has link 1b: link_b?utm_term=2024-06-28&user_id=&receitas=salgados.

  2. question 2...? a) answer has link 2a: link_a?utm_term=2024-06-28&user_id=&restricao=sal; b) answer has link 2b: link_b?utm_term=2024-06-28&user_id=&restricao=acucar.

On sending a next email, I need tu idenfify which answer was clicked bay the user to hide the whole question on this new message.

I've tried to find a userAttribute to use a Jinja if, but I think it´s not enable in the account for this specific situation.


Solution

  • There is very limited information here on how you have executed the campaign, but let me give it a try.

    JINJA would be helpful in case the answer is available as a user attribute, but in this case, you would be able to identify the answer through a click, which would be an event on Moengage.

    Below are the possible solutions -

    1. One time Campaigns If you have set up one-time campaigns, then hiding HTML based on the response would not be possible since one-time campaigns would not have the context of the events. In such a case, you will need to create multiple email campaigns where the segments are created based on the email click event with the string you are looking for in the URL.

    2. Flow In case you have set up a flow and the email you are referring to is the first email, then you can add a 'Has done event' check to check for email clicks; you can then add an email node, where you can use the event attributes from the click event to hide or show the content in the next email.

    Sample JINJA

    {% if 'salgados' in EventAttribute['MOE_EMAIL_CLICK․link'] %}
    
    Your content here
    
    {% endif %}