I am trying to capture IP address, hash it and store the value in session-scoped dimension in Google Analytics
First, I am firing a custom JS tag to get user IP using this method :
function getIP(json) {
dataLayer.push({"event":"ipEvent","ipAddress" : json.ip});
}
</script>
<script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"></script>
The script creates an "ipEvent" which pulls the user IP and triggers the "hash 2 ip scrambled" event to hash the values. Everything works fine but the problem is when I need to send hashed values via Pageview which is executed on [3] Container loaded.
You can see from the screenshot that the script to get IP was executed before "[3] Container loaded" message but an actual event happened after.
Any idea how this can be done (get "ipEvent" before [3] Container loaded)
