TransWikia.com

Cloning Objects in Google Optimize

Stack Overflow Asked by JPFotoz on March 4, 2021

I’m trying to clone a button in Google Optimize (or any other javascript/jQuery method) that adds an item into a shopping cart. My problem is that when I run the code or experiment in Optimize, the button doesn’t trigger.

Here’s my two different attempts. Method 1 via Optimizes’ interface.

  1. Select the button to copy, use the ‘edit code’ to get the html.
  2. Use Insert HTML a the location of the new button, and insert the code.

Version 2 uses jQuery’s clone();

$('#SOME-ID > PATH TO THE ELEMENT TO CLONE').clone().attr('id', 'ADD-ID-FOR-GTM-TRACKING').appendTo('#proPriceMobile');

What could the problem be?
Thanks in advance!

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP