Code: Select all
javascript:gtag('event', 'Hotspot Clickeado', {
'event_category': player.getVariableValue('UA_category'),
'event_label': $(this).parent().find('.ggskin_text ').children().first().html()
});
Code: Select all
javascript:gtag('event', 'Hotspot Clickeado', {
'event_category': player.getVariableValue('UA_category'),
'event_label': $(this).parent().find('.ggskin_text ').children().first().html()
});
Code: Select all
javascript:var label=$(this).closest('.ggskin_hotspot ').find('.ggskin_text ').children().first().html();
console.log('label:'+label);gtag('event', 'Hotspot Clickeado', {
'event_category': player.getVariableValue('UA_category'),
'event_label': label
});
Code: Select all
javascript:gtag('event', 'Photo Button', {
'event_category': player.getVariableValue('UA_category'),
'event_label': player.userdata.title
});
you can click on "Note Change" for more information on this event. Further I guess the "Button click" event is on page2 as you are only seeing the 6 most events (little arrows on the bottom)JRumball wrote: ↑Mon Jan 18, 2021 1:52 pm Yes I sure do.
Actually, I did a bit more digging inside the GA console abd discovered that the udt is indeed being captured, but just not been by displayed in this new version of the GA console.
So I think the GA component is working fine... I just need to learn how to extract the info I’m looking for from GA.
Thanks Martin.
Hello Marco,Marco360 wrote: ↑Thu Jun 04, 2020 2:27 pm Hey All,
fantastic to get GA now in the tours.
Due to DSGVO (German equivalent to GDPR) you'll need to get the opt-in from visitors to use GA, or am I wrong?
Therefore I put the consent-cookie-request before (linked in index.html) and changed the component-text to only load the gtag in case of opt-in. works amazing (feel free to ask if you're interested), BUT
due to 3rd-Party-Cookie-policies no tour fires events when hosted in iFrames. Therefore I'm trying to find out: how to you link the tour (if you offer hosting (keyword: cross-domain...)?
Thanks
Marco
Hey Laurent,
Code: Select all
<link rel="stylesheet" type="text/css" href="assets/cookieconsent.min.css" />
<script src="assets/cookieconsent.min.js" data-cfasync="false"></script>
Code: Select all
javascript:"Please set your Google tracking ID";
var ua_id=player.getVariableValue('UA_ID');
// Google Analytics Function for embedding tracking code
// Google Analytics Cookie Domain & Path (needed for clearing cookies – have look in the inspector to get the values needed)
var $tracking_cookie_domain = ".yourdomain.fr";
var $tracking_cookie_path = "/";
function embedTrackingCode(){
// add <script> to head
if (!window.dataLayer) {
window.dataLayer = [];
let script = document.createElement('script');
script.async=1;
script.src = 'https://www.googletagmanager.com/gtag/js?id='+ua_id;
document.head.appendChild(script);
}
function gtag() { window.dataLayer.push(arguments);}
window.gtag=gtag;
gtag('js', new Date());
gtag('config', ua_id, { 'anonymize_ip': true });
}
function deleteGACookies(){
// because the gtag cookie uses the tracking id with "-" replaced though "_"
// we have to do this string manipulation too
var $gtag_cookie = "_gat_gtag_"+ua_id.replace(/-/g, "_");
clearCookie('_ga',$tracking_cookie_domain,$tracking_cookie_path);
clearCookie('_gid',$tracking_cookie_domain,$tracking_cookie_path);
clearCookie('_gat',$tracking_cookie_domain,$tracking_cookie_path);
clearCookie($gtag_cookie,$tracking_cookie_domain,$tracking_cookie_path);
location.reload();
}
// Insites Cookie Consent with Opt-IN for MATOMO tracking Cookie
// Source: https://cookieconsent.insites.com/documentation/disabling-cookies/
window.addEventListener("load", function () {
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#edeff5",
"text": "#838391"
},
"button": {
"background": "#4b81e8"
}
},
"cookie": {
"expiryDays": 1
},
"theme": "edgeless",
"type": "opt-in",
"content": {
"message": "Zur Optimierung dieser Virtuellen Tour möchten wir Google Analytics anonym verwenden.",
"allow": "Einverstanden",
"deny": "Ablehnen",
"link": "Datenschutzerklärung",
"href": "https://yourdomain.fr/GDPR.html",
"policy": 'Cookie Einstellungen'
},
onPopupOpen: function () {
document.body.classList.add("cookieconsent-banner-opened");
},
onPopupClose: function () {
document.body.classList.remove("cookieconsent-banner-opened");
},
onInitialise: function (status) {
var type = this.options.type;
var didConsent = this.hasConsented();
if (type == 'opt-in' && didConsent) {
// enable cookies
embedTrackingCode();
}
if (type == 'opt-out' && !didConsent) {
// disable cookies
}
},
onStatusChange: function (status, chosenBefore) {
var type = this.options.type;
var didConsent = this.hasConsented();
if (type == 'opt-in' && didConsent) {
// enable cookies
embedTrackingCode();
}
if (type == 'opt-in' && !didConsent) {
// disable cookies
deleteGACookies();
}
if (type == 'opt-out' && !didConsent) {
// disable cookies
deleteGACookies();
}
},
onRevokeChoice: function () {
var type = this.options.type;
if (type == 'opt-in') {
// disable cookies
}
if (type == 'opt-out') {
// enable cookies
embedTrackingCode();
}
},
})
});
// Function for deleting Cookies (such as that ones from Google Analytics)
// Source: https://blog.tcs.de/delete-clear-google-analytics-cookies-with-javascript/
function clearCookie(d,b,c){try{if(function(h){var e=document.cookie.split(";"),a="",f="",g="";for(i=0;i<e.length;i++){a=e[i].split("=");f=a[0].replace(/^\s+|\s+$/g,"");if(f==h){if(a.length>1)g=unescape(a[1].replace(/^\s+|\s+$/g,""));return g}}return null}(d)){b=b||document.domain;c=c||"/";document.cookie=d+"=; expires="+new Date+"; domain="+b+"; path="+c}}catch(j){}};
// function for triggering a click on the cc-revoke button
// wich will show the consent banner again.
// You may use it in a link, such as this example:
// <a href="#" onclick="openCCbanner(); return false;">Cookie Consent</a>
function openCCbanner(){
var el = document.querySelector('.cc-revoke');
el.click();
}