In custom code campaigns, you create custom JavaScript code to add or manipulate any element on your page or app. You can change, move, swap, or otherwise maneuver any element with almost no limitations.
Create a custom code campaign
- Go to Web Personalization › New Campaign and click Custom Code.
- Specify the campaign settings, such as trigger, frequency, and advanced settings.
- Configure the targeting settings of the experience to determine when, where, and to whom the experience is displayed.
- Create variations using templates, based on other experiences, or using a data feed. When you are done with each variation, click Save Variation.
- Set the allocation, primary metric, and advanced experience settings.
- Configure the traffic allocation of each variation and the control group.
- Click Save Experience.
- Click the + icon to create an additional targeted experience.
- Click Preview to see how your campaign will appear, and click Save and Publish when you are ready to go live.
Custom code campaign settings
- Page Load: Execute the code immediately upon page-load of the relevant pages (that you set in the targeting step for each variation).
- Time on Page: Execute the code only after a defined amount of time has passed since the page loaded.
- Exit Intent: Execute the code when a visitor exhibits exit intent by moving the mouse cursor outside the webpage area (desktop only).
- Event: Execute the code when a specific event is fired on the page.
-
Advanced: Set multiple selections or combinations of triggers, using those described in this list or the following:
- Element click: Execute the code when a visitor clicks a specific element on the page, defined using a CSS selector.
- Element mouseover: Execute the code when a visitor hovers over a specific element on the page, defined using a CSS selector.
- Element load: Execute the code when a specific element loads on the page, defined using a CSS selector.
- External component: Execute the code when an external component, such as a jQuery, loads.
Frequency
- Once per pageview: Visitors see the campaign every time they meet the targeting conditions, upon every pageload.
- Once per session: Visitors see the campaign when they first meet the targeting conditions, and then no longer see it for the remainder of their session.
- Once per day/week/month: Visitors see the campaign when they meet the targeting conditions, and then no longer see it for the remainder of the day, week, or month, depending on the timeframe selection.
- Once per user: Visitors see the campaign only once, when they first meet the targeting conditions.