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:
- Is this expected behavior?
- Are the network requests associated with the events configured with the Google Tag Manager template sent with beacon?
- Is there a better way to test this?
- Should I simply use the “Custom HTML” tag type to configure these conversion events?