Advanced Settings
Implementing Macros
overview macros allow you to pass transaction and customer information into your offer units, creating personalized experiences that improve engagement and conversion rates this guide explains how to implement macros effectively in your momentscience integration with macros you can personalize offers with customer information confirm completed transactions to build trust improve conversion rates with contextually relevant content how macros work macros are placeholder variables enclosed in double curly braces ( {{macro name}} ) that are replaced with actual values when the offer is displayed for these to function properly, you must pass the corresponding data in your payload recommended macros macro description required in payload {{confirmationref}} passes the order or transaction confirmation number into the offer unit this reassures users that their transaction is complete and draws attention to available offers confirmationref {{firstname}} inserts the customer's first name into the offer unit personalizing content with a name encourages users to engage with the presented offers firstname {{payload attribute}} any other custom attribute from your payload can be used as a macro for further personalization of the momentscience unit the specific attribute name use these macros in your theme's text fields to dynamically insert relevant customer or transaction data, improving both user trust and conversion rates implementation steps to dynamically render personalized content in your offer units, macro placeholders must be correctly defined and matched with values in your payload if a value is missing, the placeholder will appear blank step 1 configure macros in your theme navigate to the theme customizer in your momentscience dashboard in the header or lead in text fields, insert your macro placeholders using double curly braces {{ }} for example {{firstname}} to insert the customerβs first name {{amount}} for transaction amount {{confirmationref}} for the order confirmation number use the preview panel to confirm the layout and styling render correctly with the placeholder macros the macro key used in the theme must exactly match the key provided in your payload with no spaces or special characters example use {{firstname}} , not {{ first name }} step 2 pass customer data in the payload add relevant customer and transaction data to your window\ adpxuser object window\ adpxuser = { email "customer\@example com", firstname "alex", lastname "johnson", confirmationref "ord 12345", amount "$75 50", currency "usd", paymenttype "credit", zipcode "10001", country "us" }; use macros sparingly and purposefully, avoid overcrowding messages with variables step 3 test the implementation test your implementation with various user scenarios to ensure macros render correctly in all cases example use cases use case message template description personalized offer intro {{firstname}}, based on your purchase of {{amount}}, we've selected these offers for you tailors offers post purchase using customer name and order value offer recommendations based on your purchase of {{amount}}, here are some offers you might like suggests additional offers based on spend amount order confirmation thank you, {{firstname}}! your order #{{confirmationref}} is confirmed confirms successful transactions with personalized details loyalty enrollment welcome, {{firstname}}! you've earned your first reward with order #{{confirmationref}} welcomes new loyalty members and acknowledges their first reward localized promotions exclusive deals for {{zipcode}}, {{country}} customers displays location based offers using zip code and country payment incentives thanks for paying with {{paymenttype}} enjoy these special offers just for you tailors messages based on the customerβs payment method transaction confirmation thank you, {{firstname}}! your order #{{confirmationref}} is confirmed alternate phrasing for standard order confirmation message if you encounter any issues or need support during integration, contact us at help\@momentscience com