Skip to main content

Tip of the Week: Updating PX User AND Account Attributes, plus creating a Custom Event inside an Engagement

  • 13 September 2022
  • 0 replies
  • 491 views

As a continued evolution of my previous posts about Using Merge tokens in Engagements, Setting PX User attributes with a custom Engagement button and Creating PX Custom Events with a custom Engagement button, which are all excellent capabilities that you can build into your own amazing Engagements right now, I have another new one for you all …

 

 

This time, I am putting all these use cases together and throwing in … at no additional charge … the added capability of setting an Account attribute when the user clicks a custom Engagement button.  

 

There are definitely some compelling use cases for asking users to set specific PX Account attributes related to improved Analytics filtering and Engagement Audience Logic targeting, plus I know that many of you can come up with some other excellent ones.  Be sure to post your suggestions in the thread below so others can benefit.  Thanks in advance!!!!
 

The specific customer use case requirement that spawned this post was:

------------------
How can we use an Engagement to (1) show our updated “Terms of Service” notice to users and (2) ask them to click a custom button to accept/acknowledge them and (3) set an Account attribute value to track that someone at that Account clicked that button? 

For our requirements, only one user per Account needs to click accept/acknowledge.  So, being able to do this will allow us to use Engagement Audience Logic criteria to not show this Engagement to any other users at that Account once this happens.
—------------------
 

So, this is how I did it…

 

To pull this off, I used our PX Identify and PX Custom Events JavaScript API calls in the custom button’s “onclick” event, plus leveraged our PX Merge Tokens capability to pass the proper required current userid and accountid into the PX Identify call.

 

Below is how this looks in our Engagement designer view….

7sP-WLQsE58PdINC64-wBiyrIBYpRpFZPuC9d_kReU7hZJYrROMwekHZoILBBKOvGizOuptYutPl4uRrN9FFsAfKtrO2FRzfmVy9AUA6BhuG7H3Qrcb8WZYI28U2czpjjFRzkmMYU3aEJbK_4D6ZnEMcMIX__KxydYehdYA-xWc3mBZ0iEinch8i-Q

… and here is the dialog Engagement source HTML code for your review.  Be sure to check out the highlighted sections for everything that you will need to pull this off for your users…

 

--------------

<strong>Merge token fields:</strong>

<br>

<br>User.id: {{User.id}}

<br>Account.id: {{Account.id}}

<br>

<br>

<br>

<br><strong>Try a button that calls PX Identify to set PX User and Account attributes:</strong>

<br>

<br>

<p><span style="color: #000;"> </span> <span class="apt-custom-button" style="color: #ffffff; font-family: Arial, Helvetica, sans-serif;">&nbsp; <a href="." onclick="aptrinsic('identify',{'id':'{{User.id}}','sampleCustomString':'my sample string', 'sampleCustomNumber':66, 'sampleCustomDate':1522697426479, 'sampleCustomBoolean':true },{'id':'{{Account.id}}','sampleStringPXField':'my sample string','sampleNumberPXField':66,'sampleDatePXField':1522697426479,'sampleBooleanPXField':true}); return false;this.window.close();" style="text-decoration: none; color: inherit;"><span style="text-align: center; line-height: normal; border-radius: 3px ; background-color: #0181c8; padding: 10px 15px 10px 15px; display:inline-block; margin-left: auto; margin-right: auto; cursor: pointer; font-size: 13px;">Identify Only</span></a></span></p>

<br>

<br><strong>Try a button that calls PX Identify and also creates a new PX Custom Event:</strong>

<br>

<br>

<br>

<p><span style="color: #000;">&nbsp;</span> <span class="apt-custom-button" style="color: #ffffff; font-family: Arial, Helvetica, sans-serif;">&nbsp; <a href="." onclick="aptrinsic('identify',{'id':'{{User.id}}','sampleCustomString':'my sample string 2', 'sampleCustomNumber':87, 'sampleCustomDate':1622697426479, 'sampleCustomBoolean':false },{'id':'{{Account.id}}','sampleStringPXField':'my sample string 2','sampleNumberPXField':87,'sampleDatePXField':1322697426479,'sampleBooleanPXField':false}); aptrinsic('track', 'LearnMore', {'clicked': 'false'});return false;this.window.close();" style="text-decoration: none; color: inherit;"><span style="text-align: center; line-height: normal; border-radius: 3px ; background-color: #0181c8; padding: 10px 15px 10px 15px; display:inline-block; margin-left: auto; margin-right: auto; cursor: pointer; font-size: 13px;">Identify plus Custom Event</span></a></span></p>

--------------

 

So, here are the results…

 

This is how this dialog Engagement looks in the application when it plays…

jw-iNCERaPtZPcvcvUF0eRwGy2UphEaN3OCd_8j7ohkH0WYh8cm6-zzOskrZpoY4Kkzi58XkYmLFTK6LjjK-FAID39Uuud4hSZZtwhlbFEolFqUX4DoAx4eQSYV97PamUBK5H3uGLscwgCvpTnpeKIHTk6D7ltkk8dAbFsFohdJxP0WgvZnBFU-qDQ

 

… a​​​​nd this is how the results look in the PX User’s profile Activities section after a user clicks each of these these custom buttons within that dialog Engagement…

lV3eCduBERppbcbS5p1qdkQgrjCLz4MLwwMMZQa7JkI65RKpMVUjoQFd3PAisaHPI7LnulNVxL3qqq42r_OhhYIZll_EJX-vJfZ9kNZV9TuYnYskxNHmb16gDHAo-W8l4H_rgS5U779laB3zHqVxP7hY2EXQJpJ7ahHBoHfPEUu04EJB0j8p00PHQg

 

And finally, here is how to exclude users from these Accounts from seeing this dialog Engagement once any of their fellow employees have clicked the custom button that sets the PX Account attribute…

R-ZO2nqbNlvxGFwV2DjrDD7UnfXAdY4O3bmFEA8u850ZSskAmnf7MD01Rdv2NP90bNHJ1Izjw_7rU9nr0YW-goefh81RjcOHFh9DaRxSOwkUt6UgNPHDw1LSKBIB50UCgPvm2DnT8dPCWP7z7lWdaP5j5CfcxhybGDrlct2sHBdqWvUbl5-l2yAl8A

 

Happy PX-ing!

Be the first to reply!

Reply