Skip to main content
Add to Cart, Initiate Checkout and View Content are events: actions a visitor takes on your store that Cometly records. The Cometly pixel (the tracking script on your site) captures general visitor activity on its own, but you set each of these events up yourself, however the pixel was installed. This guide shows you how to track Add to Cart and Initiate Checkout events with Google Tag Manager (GTM). Once the events fire, you can see which ads bring shoppers who add a product to their cart or start checkout, not only the ones who buy. That shows you where shoppers drop off between the ad click and the purchase.

Before you start

  • You need a Google Tag Manager web container on your store. If you do not have one yet, set up a new GTM web container first.
  • The Cometly pixel must load on every page of your store.
If the Cometly pixel is already on your store (hard-coded in the <head> or installed by the Cometly WooCommerce plugin), do not install it again through Google Tag Manager. Skip to Set up the events in Google Tag Manager.

Add the Cometly pixel in Google Tag Manager

Only do this if the pixel is not on your store yet.
  1. In Cometly, go to Setup, open the step Install the Cometly pixel, and click Copy Code under Install the pixel. See Install the Cometly pixel for details.
  2. In your GTM workspace, add a new tag and name it Cometly Pixel.
  3. Click Tag Configuration and choose a Custom HTML tag.
  4. Paste your Cometly pixel into the HTML box.
  5. Set the trigger to All Pages.

Set up the events in Google Tag Manager

The video walks through the full setup in Google Tag Manager.
The video mentions a second tag called init. That tag has been deprecated, so ignore every reference to it. The only pixel tag you need in Google Tag Manager is the Cometly pixel, and only when the pixel is not already on your site.
The steps shown in the video:
  1. Configure the built-in variables.
  2. Create an All Clicks trigger.
  3. Use GTM preview mode to see the Click Text and Click Classes of each click on your store.
  4. Add the tag Cometly - Add To Cart.
  5. Add the tag Cometly - Initiate Checkout.
  6. Add the tag Cometly - View Content.

Event code

Each tag is a Custom HTML tag that holds one of these snippets. Add to Cart
Initiate Checkout
View Content

Pre-purchase upsell apps: set up the Add to Cart trigger

If your store uses a pre-purchase upsell app, this video shows how to set up the Add to Cart trigger for it.

Check it worked

Open your store with GTM preview mode on, add a product to your cart and start checkout, and confirm that each Cometly tag fires. Then, in Cometly, go to Events Manager, open the Events Log tab and set Source to Browser: the events you triggered are listed there. You can also test them on your store with the Cometly Pixel Helper.

Frequently asked questions

Do I need Google Tag Manager to track Add to Cart and Initiate Checkout events on WooCommerce?

Not if you use the Cometly WooCommerce plugin. The plugin fires the Add to Cart and Initiate Checkout events for you, along with the Purchase event. See the WooCommerce integration.

Does the Cometly pixel have to be in Google Tag Manager for these events to fire?

No. The events fire properly when the pixel is hard-coded on your store. Only add the pixel through Google Tag Manager if it is not on your store yet, so it is never installed twice.

Where do I see Add to Cart and Initiate Checkout in my Cometly reports?

Both are standard events, and each has its own metric: Add to Cart counts add to cart actions and Initiate Checkout counts checkout initiations. See the metrics glossary for the full list.

Next steps

Still have questions or need a hand? We’re happy to help. Reach our team at support@cometly.com.