Announcement

Collapse
No announcement yet.

Make MVT entities available to <scritpt>

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

    Make MVT entities available to <scritpt>

    I would think this is possible but I didn't see in the docs how to accomplish it.

    I want to use the output of a couple of MVT entities as variable values to be picked up by a little javascript for google ad remarketing.

    It looked like the entities could be read by javascript but I think I'm not quite placing them correctly.

    Code:
    // using mvt entities instead of js dom objects because the script has to go into the head tag
    <script>
      var gtag_item_value = &mvt:product:price;
      var gtag_item_id = &mvt:product:id;
    
      gtag('event', 'page_view', {
        'send_to': 'AW-987194077',
        'value': gtag_item_value,
        'items': [{
          'id': gtag_item_id,
          'google_business_vertical': 'retail'
        }]
      });
    </script>
    TL;DR -- Resolution

    I was on the phone with someone from Google ads and with her help and a tech on the google end, they were able to shape the tag into what they needed. It seems that what I had written was technically correct but didn't quite address the issues they were trying to solve. But we got it done and now all is well.
    Last edited by cpp-dev; 10-17-19, 01:46 PM.

    #2
    That should work, provided you are on the Product PROD page. Are the values blank on the rendered page.
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


      #3
      That should work. Are you certain the product data has been loaded into l.settings:product ? If not you'll need to load it manually. If you know the product code, like if it's g.product_code, you can load product info like this in the page template and then use the entities:

      <mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_Code(g.product_code, l.settings:product)" />
      M.A.D.* since 1997

      http://www.scotsscripts.com

      *miva application developers

      Comment


        #4
        Yes Bruce - PhosphorMedia I am on the PROD page (sorry for not mentioning that earlier)

        Scot - ScotsScripts.com According to the token list the data should be in l.settings (see image)

        Miva Token List - snip - 2019-10-11 155346.png

        In writing this, I think I may have uncovered what the issue really is. It's that I'm getting the wrong entity. I want the product code (which is the internal sku) but I'm telling the system to pull the ID, which I believe is assigned by the Miva software.

        I'm going to try this change and then update the thread.

        == Update ==

        As this is being written on Friday, I have results on Monday. Just FYI
        Last edited by cpp-dev; 10-11-19, 04:07 PM.

        Comment


          #5
          -- Update --

          An engineer with Google is going to call and talk to me and the advertising team, tomorrow, about correctly setting up re-marketing. More info as I get it.

          Comment


            #6
            If you need to make a google feed I have a module that does this. Basically it's a feed framework module that takes extensions. I've already used it for three clients to make google feeds and it seems to be working great. If this isn't what you're talking about please disregard these words :)
            M.A.D.* since 1997

            http://www.scotsscripts.com

            *miva application developers

            Comment


              #7
              Scot - ScotsScripts.com - Thanks for the reminder, but in this case it would not resolve the issue.

              Turns out the resolution was for a tech over at google to work up some javascript to complete and compliment their tracking tag.

              So near as I can tell, what I had done was technically correct, based on what I was told was the issue, but once we got them on the phone and they were looking at what they needed it was clearer how they would resolve the issue. So ... solved, but without a firm resolution about my solution.

              Comment


                #8
                yea, basically the result every time with google IMO.
                Bruce Golub
                Phosphor Media - "Your Success is our Business"

                Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                phosphormedia.com

                Comment

                Working...
                X