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.
Add the Cometly pixel in Google Tag Manager
Only do this if the pixel is not on your store yet.- 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.
- In your GTM workspace, add a new tag and name it
Cometly Pixel. - Click Tag Configuration and choose a Custom HTML tag.
- Paste your Cometly pixel into the HTML box.
- 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:
- Configure the built-in variables.
- Create an All Clicks trigger.
- Use GTM preview mode to see the Click Text and Click Classes of each click on your store.
- Add the tag
Cometly - Add To Cart. - Add the tag
Cometly - Initiate Checkout. - Add the tag
Cometly - View Content.
Event code
Each tag is a Custom HTML tag that holds one of these snippets. Add to CartPre-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
- Check incoming events in the Events Log
- Test your events with the Cometly Pixel Helper
- Learn how standard and custom events work
- Connect your Shopify store
- Send events to ad platforms with the Conversion API