Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hello 👋
I was referring to the excellent article from "jmikesell" to implement Google Analytics. Sadly with Google Analytics version 4, lots of changes where made and I have to find new ways to link a Vuforia Studio Experience to GA.
So first you have to declare / init the GA
var s = document.createElement("script");
s.type = "text/javascript";
s.async = true;
s.src="https://www.googletagmanager.com/gtag/js?id=G-YOUR-GA-ID";
document.head.appendChild(s);
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-YOUR-GA-ID');
// declare as many events as you need.
gtag('event', 'my_action_name');
Please replace "G-YOUR-GA-ID" with your. GA id. Then you can set the gtag where you need to call them :
$scope.myAction = function() {
// doing some stuff
gtag('event', 'my_action_name');
}
Then you will see your tag in your GA account. Hope it helps.