Skip to main content

Hi there, 

Previously I ask about setting Configuration settings in Amplitude Analytics Template and @dangrainger suggested me to set up in either set User Properties (identifiy) tag or Event Properties track event tag. 

However, maybe i’m not fully understand the concept of user properties and event properties in Amplitude compare to GA.  We are looking for to set up the global configuration settings in initialise tag, so i wonder if is it the way to set up ?

May i set up a custom Javascript in GTM for the configuration settings (from Google Tag) then assign to trackingOptions in initialise tag (Amplitude Analytics Template)? Do i do the same for User properties (from Google Tag) in initialise tag(Amplitude Analytics Template)? 

 

thanks in advance

 

 

 

My solution was setting all the configuration settings in a custom js variable and pass to track() method with events.

function(){
// Add your event properties below (!! A-Z order !!)
var ep_pv = {
//configuration settings
'loggedin':{{loggedin}},
'gtm_id':{{Container ID}},
'cookie_optin':{{cookie}},
'post_type':{{post_type}},
'content_group':{{content_group}},
'ehash':{{ehash}},
}
// Removing all properties set to null or 0, to get rid of the noise
/** checks to see if the current property is not inherited from the prototype.
The first if in the loop checks to see if the value of the property is null, 'null', or 0.
If it is, it deletes the property from the object.**/
var event_properties = function(v){
for(i in v){ if(v.hasOwnProperty(i)){
if((v[i] == null) || (v[i] == 'null') || (v[i] == 0)){delete v[i];}
else {v[i] = v[i];}}}
return v;}(ep_pv);

return event_properties;
}

 


Reply