You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
close
Home > Convert > Displays > Design > Use a CTA to Trigger a Display
Use a CTA to Trigger a Display
print icon

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 Target step of the display builder. 
  • Select the When To Show section 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: 

 

Feedback
0 out of 0 found this helpful

scroll to top icon