Google Analytics - All events located in Boardman, WA

Hello,

I have setup Google Analytics events in various parts of my app.

It all works perfectly except that events are located in the city of Boardman (amazon server i guess).

As a consequence, all my traffic is doubled and all events are located in Boardman.

For instance, if I have 10 visitors from 2 different sources I will see in GA 20 visitors and all events and conversions attributed to this 10 extra visits from Boardman. Ultimately I can’t track events and conversions by source/location/etc.

I tried to:

  1. exclude traffic from Boardman -> I loose event tracking
  2. move all triggers from API workflows to Page workflows -> no impact

Any solution to that problem?

Thanks,

Jules

ps/ the problem was already there 4 months ago according to that post: Google Analytics - Getting Extra Visitor From Boardman when event triggered

The issue is the API Connector will track the server location rather than the app user’s location. Instead, please use the Google Analytics plugin or add HTML snippet in header.

Thanks for your reply Neerja.

I am not sure the Google Analytics plugin or HTML snippet can help me track “events” on Google Analytics. They only track pageviews while events are here to track button clicks and other user actions on a page.

I used this thread on the forum to setup event tracking: Google Analytics event tracking

And here is the google documentation about events: https://developers.google.com/analytics/devguides/collection/analyticsjs/events

Maybe I am missing something simple here or there is an easier way?

Thanks,
Jules

You should be able to either …

  1. Tie the &cid back to the actual GA client id - although it may need something clever to get it
  2. Override the IP
  3. Override the geoid

Thanks Nigel.

I would need to do 1. indeed as it is more than the location that I want right (the source is even more important).

So I need to work with client ids, how do I get the original client id in Bubble?

I can then put it back in the API call that sends the event and hopefully GA would know what to do, correct?

Thanks,
Jules

Yes, that is the plan, so GA will see both the GA page event, and the linked Hit, and combine them.

You need to run the following …

<script>
ga(function(tracker) {
  var clientId = tracker.get('clientId');
});
</script>

Which I think can be done with the toolbox, but quite how you pull it back into Bubble … I don’t know. Maybe @mishav or @jarrad can help ?

Thanks Nigel!

Indeed by adding this script and the toolbox plugin (update below) you can retrieve the clientId.

<script>
ga(function(tracker) {
  var clientId = tracker.get('clientId');
  bubble_fn_cid(clientId);
});
</script>

I then send this cid together with the event to GA and they match the events to the session (houra)

One last issue though:

  • The location will toggle between actual location when a pageview happens and Boardman when an event happens.
  • So I will get the location correct in my reports only when last interaction of the session is a pageview and not an event

I could not find a way to get the location or IP from GA to then override it in the event (similar to cid) …
And I don’t know if we can somehow hide the location for server hits so GA keeps the initial one …

Any idea?

Aha, that’s how you do it !

I thought that it would tie the two together in the reporting, it keeps the separate in “Real Time”. But maybe I am wrong.

The location comes from IP address, so maybe extract that, get the location code, and override geoid ?

It does tie the two together you were right!

So there is no more duplicate BUT the behavior is the following.

Let’s assume you have a user in NYC who navigates 2 pages and trigger one event in the middle. You get the following:

  1. Go to page A: user located in NYC
  2. Trigger event A: event located in Boardman, tied to user, user now located in Boardman (!!!)
  3. Go to page B: user located back in NYC

So you can go on and on and have your user location switch from NYC to Broadman based on last interaction …

Is it clear?

i did not find a way to extract goid or ip address the same way i got the client id unfortunately …

So as always the solution was pretty simple…

Instead of calling the API to send events I used the “Run Javascript” function from the toolbox plugin and added the javascript function in there when appropriate - see below:

The only caveat is that you cannot factorize a call that happens on multiple pages, but I can live with that.

Thanks Nigel for your help.

Jules

3 Likes

Genius :slight_smile: