Home Forums Themes Support Claue How to add PHP code to the website?

Viewing 1 reply thread
  • Author
    Posts
    • #8307

      Hello, where can I add a php code snipet I was given to track users for email abandonment campaigns?

      THis is the code:

      <?php
      $ImageUrl = wp_get_attachment_image_src( get_post_thumbnail_id( $loop->post->ID ), ‘single-post-thumbnail’ )[0];
      $ItemId = $product->id;
      $Title = $product-> get_title();
      $ProductUrl = “http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]&#8221;;
      $Price = $product->get_price();
      $RegularPrice = $product->get_regular_price();
      $DiscountAmount = $RegularPrice – $Price;
      $terms = get_terms( ‘product_tag’ );
      ?>

      <script>
      var Title = “<?php echo $Title; ?>”;
      var ItemId = “<?php echo $ItemId; ?>”;
      var ImageUrl = “<?php echo $ImageUrl; ?>”;
      var ProductUrl = “<?php echo $ProductUrl; ?>”;
      var Price = “<?php echo $Price; ?>”;
      var DiscountAmount = “<?php echo $DiscountAmount; ?>”;
      var RegularPrice = “<?php echo $RegularPrice; ?>”;
      var _learnq = _learnq || [];

      _learnq.push([‘track’, ‘Viewed Product’, {
      Title: Title,
      ItemId: ItemId,
      ImageUrl: ImageUrl,
      Url: ProductUrl,
      Metadata: {
      Price: Price,
      DiscountAmount: DiscountAmount,
      RegularPrice: RegularPrice
      }
      }]);
      </script>

       

      Thank you!

    • #8308

      Hi,

      you can copy file header.php in claue to claue-child and insert your code.

      Best regards

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

Viewing 1 reply thread

You must be logged in to reply to this topic.