If you're wanting to trigger a popup campaign on a button click from your site you can accomplish this exact use case by setting up an anchor link on the button on your site (ex: <a href=โ#show_signup"></a>)
โ
โ
๐ป Prepare the Anchor Link on Your Site
Add an anchor link to your button. Example: <a href="#show_signup"></a>
. This link will serve as the conditions for your campaign to show.
โ
๐ Set Up the Campaign in Amped
Visitor Segment: Select 'All Visitors' as you want this to show anytime the link is clicked (you could use others but Amped will consider all the targeting rules vs โAll Visitorsโ is more wide open)
Trigger Configuration: Use โTime on page of 0 secondsโ
Page Targeting: Choose โCurrently Viewing a page URLโ that contains "#show_signup" or whatever you set in your anchor link.
Frequency Setting: Set this to 'Once per page view' to activate the campaign each time the link is clicked.
Safe Display Setting: Choose 'Autonomous' under 'Safe Display' so that the campaign shows regardless of if the visitor has seen other Amped campaigns recently.
โ
๐ Add Code for #Hashtag Removal
You will want to make sure the X's on all steps, as well as the last step CTA to return to site all include a piece of custom code to remove the hashtag from the url so that your campaign doesn't continually fire.
โ
Navigate to the X's/last step CTA > Button Actions > Add Action
Select "Custom Code"
Rename to "Remove #" and paste script into body, then save!
โ
๐ป Here is the script to use in your campaign
// Remove the Hash fragment from the URL
function removeHashFragment() {
if (window.location.hash) {
// Remove any hash fragment while keeping the pathname and search parameters
history.replaceState(null, null, window.location.pathname + window.location.search);
}
}
// Call the function to remove the hash fragment if present
removeHashFragment();
resolve(); // resolve(); tells your ad to continue. Otherwise the ad will load indefinitely, break, and it will timeout.
Copy this process on each X (on all steps) as well as the last step CTA to ensure whenever the campaign is closed, the hashtag is removed.
โ
๐ Publish the Campaign
Reminder you will need to publish your campaign for this to work! Once it's live, you will be able to open the campaign on the button click from your site!