To increase chances of conversion on your site's cart page, you may want to increase the visibility of the checkout button by duplicating it elsewhere on the page. You can accomplish this goal by creating a custom Duplicate Element action that also retains its bindings to the cart form submit. This use case demonstrates exactly how to accomplish this goal with a custom action added to an experience.
Creating the Duplicate Element Action
Follow these steps to create the custom Duplicate Element action.
- Click COMPONENTS and then select Actions.
- Click CREATE ACTION.
- After Action Builder loads on your site, navigate to any product on the site and add it to the cart.
- Navigate to the cart page. For this use case, the cart page has a Check Out button near the bottom of the page.
- Use Chrome's Developer tools to look at the site's code, specifically the code for the checkout button.
- To retain the element's native functionality, select Duplicate Element on the Insert Content tab of Action Builder.
- Find the selector for the Check Out button, and then click the forward arrow.
- Identify a rough selector for where the cloned button should appear, understanding that you can refine the element selector on the Details tab to ensure it falls within the
form
parent. For this use case, the "Shopping Cart" page heading is the selector. Click the forward arrow. - Ensure Enable Preview is set to ON, and then test the cloned element from the Details tab. In this use case, the cloned Check Out button appears, but clicking it doesn't load the checkout page as expected.
- If the action preview doesn't work as intended, check your browser's Developer tools. In this use case, Developer tools reveals that the code for the cloned button is above the
<form>
element when the cloned code needs to be within it. - Correct any coding errors that you find. In this use case, the selector for the
<form>
element is the correct one to use in Relative Element Selector in Action Builder. - Test the cloned button again. In this use case, the second test reveals that clicking it loads the checkout page as expected.
- With Relative Element Selector set, use the information from Element Selectors to simplify the selectors a little bit. For this use case, the simplified selectors are as follows:
- Element To Clone —
.cart__buttons button.btn
- Relative Element Selector —
form.cart
- Element To Clone —
- Click the Styles tab to add the following CSS to ensure that the cloned button matches the original one:
<CLONE_SELECTOR> {float: right;}
- Add an action condition to ensure the action only fires on the cart page. Click the Conditions tab, click ADD CONDITION, expand Page type, and then select Page type =. Input the value to identify the page type. After that, click the forward arrow.
- Give the action a title, a description, and a subcategory, and then click CREATE & EXIT.
Now that you've created the Duplicate Element action, add it to an experience to deploy it to your site.
Creating the Experience
Follow these steps to create the experience that uses the custom Duplicate Element action.
- Click EXPERIENCES in the top navigation bar, and then select Web.
- Click CREATE EXPERIENCE.
- Click WHY, select To serve everyone the same experience, and then click NEXT.
- Select a goal metric, adjust the secondary metrics as necessary, and then confirm that you've configured the WHY settings as you need.
- Configure the WHO settings as necessary. For this use case, the experience should target all site visitors, so there's no need to change the WHO settings.
- Add the Duplicate Element action to the experience. Click WHAT and then click ADD ACTION.
- Click Other.
- Click the Duplicate Element action that you created for this experience.
- Because the action was so specifically configured in Action Builder, no experience-level changes are required. Click CREATE.
Ensure you test the experience before activating it.
Testing the Experience
Before scheduling when the experience runs by configuring the WHEN settings, you should perform a quality assurance check to ensure the action works as expected.
- Click PREVIEW.
- Add a product to the cart on your site, and then navigate to the cart page. The cloned button should appear just below the level of the "Shopping Cart" page heading.
- Click the cloned button to verify that doing so loads the checkout page.
After you confirm that the action and experience fired as expected, return to the Experience Editor page in the Monetate platform to configure the experience's WHEN settings as necessary and then click ACTIVATE.