Use a CTA to Trigger a Display

If you'd like a visitor to manually trigger one of your Convert displays by clicking a specific call-to-action (CTA), you can use an onClick JavaScript function. 

Note: Custom JavaScript is outside the scope of Privy Support. The team cannot help you implement this on your site or troubleshoot issues related to its use. 

Prepare the display

To properly trigger the display without conflicts: 

  • Navigate to Convert > All Displays.
  • Select the display you'd like to trigger. 
  • Navigate to the Create step of the display builder.
  • Make sure the Tab Design setting is set to No tab

  • Navigate to the Settings step of the display builder. 
  • Select the Scheduling card and ensure all the Automatically Show settings are disabled. 

  • Save the changes and Publish the display. 

Create and apply the function

To create the onClick JavaScript function that triggers the display:

  • Take note of the URL displayed when viewing the display page and copy the number listed after displays. This is the display's ID. 

  • Add the function listed below to your site's HTML to create the button. Make sure to replace "XYZ" with your display number, update the button text, and style the button so that it matches your site's branding. 
<button onClick="Privy('show', XYZ);">Attend Our Event</button>

See it in use

Once you add the button to your content, a visitor's click will trigger the display: 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us