• 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.
Viewing 1 replies (of 1 total)
  • Thread Starter varoon

    (@varoon)

    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.
Viewing 1 replies (of 1 total)

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