Advanced Settings
Implementing Macros
11 min
overview macros allow you to pass transaction and customer data into your offer units, creating personalized experiences that increase engagement and conversion when configured correctly, macros replace placeholder variables (e g , {{firstname}} ) with live data from your payload or url parameters 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 when using macros through the shopify integration, only {{first name}} and {{last name}} are supported these macros will render only if the customer is logged in to their shopify account at the time of purchase if the customer checks out as a guest, no macros will be displayed for more information about configuring and personalizing offers with momentperks, refer to the customizing momentperks docid\ jcczrozbi5d0pvdqm15kx guide 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 using javascript sdk 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 using direct links perkswall supports macros within title text, allowing you to personalize user experiences without initializing through the sdk to pass macro values, include them as query parameters in the perkswall url each macro key corresponds to a parameter name, and when the link opens, perkswall replaces placeholders (for example, {{firstname}} ) with the provided values example https //naojs pubtailer com/perkswall?accountid=fb2220c22202f4\&themeid=maintheme\&firstname=jon\&confirmationref=ord 78910\&amount=45 50 https //naojs pubtailer com/perkswall?accountid=fb2220c22202f4\&themeid=maintheme\&firstname=jon\&confirmationref=ord 78910\&amount=45 50 if your title text is thanks, {{firstname}}! your order #{{confirmationref}} totaling ${{amount}} is confirmed it displays as thanks, jon! your order #ord 78910 totaling $45 50 is confirmed 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