1. Help Center
  2. Integrations
  3. Ecommerce Platform Integrations

WooCommerce

If you use WooCommerce (WordPress), please follow these instructions:

Setup Voyage Global Tag

    1. In your WordPress dashboard, hover Plugins then, click Add New.
    2. Search for Code Snippets.
    3. Click Install Now under “Code Snippets” and then activate the plugin.
    4. From WordPress dashboard menu hover Snippets then, click Add New.
    5. Give it a title (e.g. Voyage Global Tag) and paste the code snippet (shown below) in the Code text area. Replace [CLIENT ID] with the client ID provided by your Voyage account manager.
    6. Click Activate.
    add_action( 'wp_head', function () { ?>
    <script type="text/javascript">
    /* <![CDATA[ */
    (function(){if(window.voyage)return;window.voyage={q:[]};var fns=["init","event","track"];
    for(var i=0;i<fns.length;i++){(function(fn){window.voyage[fn]=function(){
    this.q.push([fn,arguments]);}})(fns[i])}})();voyage.init("[CLIENT ID]", { popup: true});
    /* ]]> */
    </script>
    <script async src="https://assets.voyagetext.com/voyage.production.js"></script>
    <?php } );

    Setup Purchase Pixel

    If you are using default 'thank you' page:

    1. In your WordPress dashboard, hover Plugins then, click Add New.
    2. Search for Code Snippets.
    3. Click Install Now under “Code Snippets” and then activate the plugin.
    4. From WordPress dashboard menu hover Snippets then, click Add New.
    5. Give it a title (e.g. Voyage Purchase Pixel) and paste the code snippet (shown below) in the Code text area.
    6. Click Activate.
    add_action( 'woocommerce_thankyou', function ( $order_id ) { 
    $order = wc_get_order( $order_id );
    ?>
    <script type="text/javascript">
    voyage.track("Purchase", { amountCents: <?php echo $order->get_total()*100; ?> , orderId: <?php echo $order_id; ?> });
    </script>
    <?php
    } );

    if you are using custom 'thank you' page:

    StyGbJhS4a

    1. In your WordPress dashboard, navigate to Appearance > Theme Editor
    2. Open woocommerce/checkout/thankyou.php in your current active theme file
    3. Add the following line of code at the end of your thankyou.php and update
    <script>voyage&&voyage.track("Purchase",{amountCents:<?php echo $order->get_total()*100; ?>});</script>