Announcement

Collapse
No announcement yet.

google shopping code - product reference

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    google shopping code - product reference

    I have this on the client site:

    <!-- Global site tag (gtag.js) - Google Ads: 9999999999 -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=AW-1070651145"></script>
    <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-9999999999'); </script>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%27Product%20Page%27">
    <!-- Event snippet for Xmas 2018 conversion page In your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->
    <script> function gtag_report_conversion(url) { var callback = function () { if (typeof(url) != 'undefined') { window.location = url; } }; gtag('event', 'conversion', { 'send_to': 'AW-9999999999/xuDfCKbjyogBEImuw_4D', 'value': <actinic:block if="%3cactinic%3avariable%20name%3d%22IsGoogleExportIncludeTax%22%20%2f%3e" ><actinic:variable name="TaxInclusivePriceRaw" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsGoogleExportIncludeTax%22%20%2f%3e%20%3d%3d%200" ><actinic:variable name="TaxExclusivePriceRaw" selectable="false" /></actinic:block>, 'currency': 'GBP', 'transaction_id': '<actinic:variable name="ProdRef" />', 'event_callback': callback }); return false; } </script>
    </actinic:block>

    It works fine except <actinic:variable name="ProdRef" /> produces:
    NETQUOTEVAR:PRODREF What variable should I use for : 'transaction_id': '?????' Thank you!
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    #2
    You are using something intended for the Cart / Checkout pages on a Product Page. Try <actinic:variable name="ProductReference" />.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thank you Norman, I have gone for encoded product anchor.

      This is what I now have so far

      Google wants to know whent he Add To Cart Button is clicked. So far I have this for the Add to cart button (just one shown for clarity)

      Code:
      <input value="<Actinic:Variable Name="CartButtonText"/>" name="_<Actinic:Variable Name="ProductID"/>" type="submit" class="button cart-button trackingbutton" onclick="return ValidateChoices(&#34;<actinic:variable name="ProductID" />&#34; gtag_report_conversion(&#34;<actinic:variable name="CanonicalPageURL" />&#34;));"/>
      And this is my script that executes when he card button is clicked. SD doesn't like it, how can I improve it?

      Code:
      <script>
      $( document ).ready(function() {
      
      function gtag_report_conversion(url) { var callback = function () { if (typeof(url) != 'undefined') { window.location = url; } }; gtag('event', 'conversion', { 'send_to': 'AW-1070651145/xuDfCKbjyogBEImuw_4D', 'value':  <actinic:block if="%3cactinic%3avariable%20name%3d%22ProductPriceOnline%22%20%2f%3e%20%3e%20%270%27" ><actinic:block if="%3cactinic%3avariable%20name%3d%22IsGoogleExportIncludeTax%22%20%2f%3e" ><actinic:variable name="TaxInclusivePriceRaw" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsGoogleExportIncludeTax%22%20%2f%3e%20%3d%3d%200" ><actinic:variable name="TaxExclusivePriceRaw" selectable="false" /></actinic:block></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22ProductPriceOnline%22%20%2f%3e%20%3d%3d%20%270%27" ><actinic:block if="%3cactinic%3avariable%20name%3d%22IsGoogleExportIncludeTax%22%20%2f%3e" ><actinic:variable name="AssociatedProduct::TaxInclusivePriceRaw" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsGoogleExportIncludeTax%22%20%2f%3e%20%3d%3d%200" ><actinic:variable name="AssociatedProduct::TaxExclusivePriceRaw" selectable="false" /></actinic:block></actinic:block>, 'currency': 'GBP', 'transaction_id': '<actinic:variable name="EncodedProductAnchor" selectable="false" />', 'event_callback': callback }); return false;
      }
      $(".trackingbutton").click(function() {gtag_report_conversion()});
      });
      </script>
      Thank you



      Jonathan Chappell
      Website Designer
      SellerDeck Website Designer
      Actinic to SellerDeck upgrades
      Graphicz Limited - www.graphicz.co.uk

      Comment


        #4
        Do things in the correct sequence and leave SD's ValidateChoices call intact. Try:

        Code:
        onclick="gtag_report_conversion(&#34;<actinic:variable name="CanonicalPageURL" />&#34;); return ValidateChoices(&#34;<actinic:variable name="ProductID" />&#34;);"
        As for your other script. This is code that will only work on a Product Page as it has product parameters embedded in it. Not something I can debug here or fix for free.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Thank you Norman

          I included product page variables as the script executes on the product page when the 'Buy Now' button is clicked and thence sends the pricing information to Google.

          Best wishes
          Jonathan Chappell
          Website Designer
          SellerDeck Website Designer
          Actinic to SellerDeck upgrades
          Graphicz Limited - www.graphicz.co.uk

          Comment

          Working...
          X