Title: Custom tracking script &#8211; Track events
Last modified: September 11, 2020

---

# Custom tracking script – Track events

 *  [varoon](https://wordpress.org/support/users/varoon/)
 * (@varoon)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/custom-tracking-script-track-events/)
 * Hi,
 * My client is creating an advertising campaign with some third-party.
 * Need to track,
    1. Add to Cart 2. Place order 3. thank you
 * The script they gave is, (Three scripts for each tracking)
 * `<script>(function(){var VendorPixelURL = 'https://sample.com/event/tracking.
   php?VendorpixelId=1234&_w=1&rd='+new Date().getTime();(new Image()).src = VendorPixelURL;})();
   </script><noscript><img height='1' width='1' style='display:none' src='https://
   sample.com/event/tracking.php?VendorpixelId=1234&_w=1'/></noscript>`
 * Where to add this to “track” events?
 * Any help?
    -  This topic was modified 5 years, 8 months ago by [varoon](https://wordpress.org/support/users/varoon/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [varoon](https://wordpress.org/support/users/varoon/)
 * (@varoon)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/custom-tracking-script-track-events/#post-13404175)
 * Hi Support,
 * We wanted to track how many user completes a transition and visit the thank-you
   page.
 * Added the below code on the “theme functions.php” file at the bottom.
    is this
   the correct way?
 *     ```
       add_action( 'woocommerce_thankyou', 'click_tracking_thank_you' );
       function click_tracking_thank_you()
       {
       ?> 
   
       <script>(function(){var VendorPixelURL = 'https://sample.com/event/tracking.php?VendorpixelId=1111&_w=1&rd='+new Date().getTime();(new Image()).src = VendorPixelURL;})();</script><noscript><img height='1' width='1' style='display:none' src='https://sample.com/event/tracking.php?VendorpixelId=1111&_w=1'/></noscript>
   
       <?php
       }
       ```
   
    -  This reply was modified 5 years, 8 months ago by [varoon](https://wordpress.org/support/users/varoon/).

Viewing 1 replies (of 1 total)

The topic ‘Custom tracking script – Track events’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [cart](https://wordpress.org/support/topic-tag/cart/)
 * [event](https://wordpress.org/support/topic-tag/event/)
 * [order](https://wordpress.org/support/topic-tag/order/)
 * [script](https://wordpress.org/support/topic-tag/script/)
 * [track](https://wordpress.org/support/topic-tag/track/)

 * 1 reply
 * 1 participant
 * Last reply from: [varoon](https://wordpress.org/support/users/varoon/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/custom-tracking-script-track-events/#post-13404175)
 * Status: not resolved