Is it possible to extend the Google analytics script?
I would like to set this: ga(‘set’, 'userId", {{21}});
Right after the analytics script is initialized.
I have tried this, but no luck there.
_trackingScriptService.GetHeaderScripts(currentPage, new List string{ “ga(‘set’, 'userId”, {{21}});"});
Litium version:6
I am not too familiar with this service but you are calling a Get method here.
Yes, I am Getting the header scripts, and I can send in an object to that one to extend the scripts. But i can’t figure out how to use that in parameter
Do you have any idea, or documentation about this?
I will check with others to see if u can get an answer
I got no good answers from anyone but check the GA documentation and see if you find something: https://developers.google.com/analytics/devguides/collection/analyticsjs/events
I don’t want to send an event, i want to set a user id on the analytics events.
So noone knows how to use a feature implemented by Litium?
I think you should test to use an object
instead of string
when you create the List
so something like new List<object> { "'set', 'userId', '21'" }
should print out the value when the script is rendered.
1 Like