You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
GTM recently released a new feature Custom Templates. It gives an ability to create templates for tags and variables in GTM, and the most useful feature – you can import and export those templates between projects.
I think it would be great to create GTM template for the Amplitude snippet and share it in this repository.
I've tried to move Amplitude snippet by myself, but GTM templates use sandboxed version of JavaScript, so I can't just copypaste the code. I found some troubles because I can't really get some parts of the snippet and don't know how you use it later.
Here's my code and my thouhgts about problem
This part of code works greate:
var setInWindow = require('setInWindow');
var injectScript = require('injectScript');
var callInWindow = require('callInWindow');
var logToConsole = require('logToConsole');
setInWindow('amplitude', {_q: [], _iq: {}});
injectScript('https://cdn.amplitude.com/libs/amplitude-4.4.0-min.gz.js', function () {
if (!callInWindow('amplitude.runQueuedFunctions')) {
logToConsole("[Amplitude] Error: could not load SDK");
}
}, data.gtmOnFailure);
Hello,
GTM recently released a new feature Custom Templates. It gives an ability to create templates for tags and variables in GTM, and the most useful feature – you can import and export those templates between projects.
I think it would be great to create GTM template for the Amplitude snippet and share it in this repository.
I've tried to move Amplitude snippet by myself, but GTM templates use sandboxed version of JavaScript, so I can't just copypaste the code. I found some troubles because I can't really get some parts of the snippet and don't know how you use it later.
Here's my code and my thouhgts about problem
This part of code works greate:
This part doesn't work:
It throwns errors, such as
Because in sandboxed JS we can't
I think we can rewrite this invalid code using method
createArgumentsQueue
orcreateQueue
, but I really don't know how 🙂Would be grateful for your help.
The text was updated successfully, but these errors were encountered: