[VTEX Legacy] How to set up the order placed event through Google Tag Manager

Before you can set up the Order Placed event tag following the instructions below, you need to first create the Order Placed trigger in your Google Tag Manager container.


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 event code in the HMTL container.

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

4. Change the orderID value with the Order ID variable you have created.

Attention: you should replace the value of the orderID attribute with the variable you created in your Google Tag Manager container.

How to add a variable in the event code?

  • Make sure you already created the Order ID variable.
  • To add a variable in the event code you can use curly braces {{ }} as seen in the screenshot below.
  • When you type in {{ all the Variables in your container appear in a dropdown.
  • Select the variable you created as in the screenshot below, or just paste the exact variable name.
  • Don’t forget to close the curly braces with }}

Once you inserted the Order ID variable, the code should look like this.

5. Click on Triggering.

Make sure you have created the Order Placed trigger before continuing to this step.

6. Select the Order Placed trigger you created.

7. Name your tag and click on Save.

8. 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.