[VTEX Legacy] How to set up add to cart event through Google Tag Manager

Create the Add to Cart event tag

Before you can set up the Add to Cart event tag following the instructions below, you need to have an Add to Cart trigger set up in your Google Tag Manager container.

  • You may already have an Add to Cart trigger set up in your container. If you’re not sure, see here on how to check.
  • If you don’t have an Add to Cart trigger in your Google Tag Manager container, see how to create one here.

1. Go to your Google Tag Manager account and add a New Tag.

2. Click on Tag Configuration and scroll further down to select “Custom HTML”.

3. Insert the Add to Cart event code in the HMTL container.

<script>
window.ugr=window.ugr||function(){(window.ugr.q=window.ugr.q||[]).push(arguments)};
ugr('event', 'addToCart');
</script>

4. Under Trigger, select the trigger that is relevant for your website.

  • If you already have a custom event trigger for add to cart events you can use it as a trigger for this tag.
  • If you don’t have an add to cart trigger in your Google Tag Manager container, see how to create a click trigger here.
    • If you already created the add to cart cart trigger following the above linked instructions, click on “Triggering” and select the Add to Cart Click trigger you created from the list.

6. Save the tag.

7. Don’t forget to preview and publish your Google Tag Manager container.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.