Google Tag Manager - Yext Conversion Template - Not Tracking As Expected

I’m working on implementing conversion tracking for a custom front-end Answers implementation. I’ve created custom conversions in two categories:

  • For custom conversion events on our website, e.g. form fill, key pageviews, etc.
  • For Answers vertical click tracking–I’m doing this as a stopgap until I can incorporate full Answers click tracking.

I’m following the steps in this article.

I’ve installed the custom template and created the associated tags. I’ve configured the corresponding triggers and am testing in Google Tag Manager preview mode. The tag is firing as expected, but not the corresponding network request to the following URL.

https://realtimeanalytics.yext.com/conversiontracking/conversion?cid=xxxxx&v=xxxxx

I should say, that network request isn’t happening when I use the custom template. If I choose to use a “Custom HTML” tag and use the code provided (See example below) in the “conversion setup” screen in Yext admin, the corresponding network requests occur as expected.

<script>
	window.ytagQ = window.ytagQ || [];
	function ytag() {window.ytagQ.push(arguments);}
	ytag('conversion', {'cid': 'xxxxxxxx});
</script>
<script async src="https://assets.sitescdn.net/ytag/ytag.min.js"></script>

Even more strange, any conversion event that is configured using the template does have the corresponding event sent to the ytagQ queue–see below for an example–but it doesn’t appear that the script is injected after the fact to process the network request, so it just sits in the queue.

Example Queue with Event Pending

[
    {
        "0": "conversion",
        "1": {
            "cid": "xxxxxx",
            "cv": ""
        }
    }
]

Code from Current Yext Template
I’ve bolded the line that I believe is not functioning as expected.

const injectScript = require('injectScript');
const createArgumentsQueue = require('createArgumentsQueue');
const url = 'https://assets.sitescdn.net/ytag/ytag.min.js';
const ytag = createArgumentsQueue('ytag', 'ytagQ');
ytag('conversion',  {'cid': data.cid, 'cv': data.cv});
**injectScript(url, data.gtmOnSuccess, data.gtmOnFailure, url);**

My Questions:

  1. Is this expected behavior?
  2. Are the network requests associated with the events configured with the Google Tag Manager template sent with beacon?
  3. Is there a better way to test this?
  4. Should I simply use the “Custom HTML” tag type to configure these conversion events?

@Zach_Shearer Hey thanks for your question!

I’m going to need a little more information to figure this out:

  1. Have you added the code for your GTM account to the <head> and <body> tags where you want your conversions fired?
  2. If so, what type of trigger are you using to trigger your Conversion Action?

When I set up my Conversion Action as shown below I’m seeing the tag fire so I don’t think it’s an issue with the template or Google Tag Manager but it could be possibly be an issue with your setup.

Mike

Example Code

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Static Template</title>

    <!-- Google Tag Manager -->
    <script>
      (function (w, d, s, l, i) {
        w[l] = w[l] || [];
        w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" });
        var f = d.getElementsByTagName(s)[0],
          j = d.createElement(s),
          dl = l != "dataLayer" ? "&l=" + l : "";
        j.async = true;
        j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
        f.parentNode.insertBefore(j, f);
      })(window, document, "script", "dataLayer", "{REPLACE_WITH_GTM_ID}");
    </script>
    <!-- End Google Tag Manager -->
  </head>
  <body>
    <!-- Google Tag Manager (noscript) -->
    <noscript
      ><iframe
        src="https://www.googletagmanager.com/ns.html?id={REPLACE_WITH_GTM_ID}"
        height="0"
        width="0"
        style="display: none; visibility: hidden;"
      ></iframe
    ></noscript>
    <!-- End Google Tag Manager (noscript) -->
    <h1>
      This is a static template, there is no bundler or bundling involved!
    </h1>
  </body>
</html>

Thanks for the reply, Michael. Yep, the Google Tag Manager script is in place and serving a number of different tags without issue.

Interesting. I’ve tried this in another Google Tag Manager container for another site and it is working as expected. I might have to do some additional testing with the first site.

For the site in question, I’d actually changed all of my tag types to use the “custom html” tag type instead of the tag template and just used the snippet provided in “conversion setup”. I can try reverting them back. Do you see any issue with me deploying the conversion events using the script–see below–instead of the tag template?

<script>
	window.ytagQ = window.ytagQ || [];
	function ytag() {window.ytagQ.push(arguments);}
	ytag('conversion', {'cid': 'xxxxxxxxxx'});
</script>
<script async src="https://assets.sitescdn.net/ytag/ytag.min.js"></script>

@Zach_Shearer Hmm yeah that is interesting - not sure why that would be based on the testing I’ve done myself.

As far as using Custom HTML versus the Template, there should be no issues deploying the code this way. Typically customers who use Google Tag Manager want to use as little code as possible so the template is the most common implementation but using Custom HTML will also work as you’ve seen.

Let me know if you have any other questions!

Mike

1 Like

@Michael_Peralta I’ve just been informed by customer service that this is not possible if we’re not using the “Pages”. We are integrating using the API.

I will be able to map Search (formerly Answers) clicks to conversion events now that we have Search click tracking configured, but it doesn’t seem that it will be possible to map deeper conversions, e.g., file download, form fill, etc. to conversions events at this time.

Just commenting for posterity for others who might come across this topic.