English 中文(简体)
How can I send data to multiple data streams from one web page using GA4?
原标题:

I would like to send data to multiple GA4 data streams from one web page. I simply want the data to go to two properties instead of just one. It would be nice if it was as simple as something like this:

<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag( js , new Date());
  gtag( config ,  G-XXXXXXXXXX );
  gtag( config ,  G-YYYYYYYYYY );
</script>

Is it possible to do what I am trying to do? If so, how should I do it?

I cannot seem to find information on how this is done specifically with GA4 and I don t want to experiment and risk making an error that causes problems in data collection.

最佳回答

Based on your setup, When you trigger an event, it will be sent to both of the GA4 id s automatically as you have configured both of them.

The real challenge will come when you only want to send an event to only one id.


How can you send an event only to one GA4 property?

You can use this by using send_to parameter in your code, which includes the target id G-XXXXXXX or G-YYYYYYY for eg:

gtag( event , conversion , {  send_to :  <TARGET_ID>  });
问题回答

暂无回答




相关问题
How to divide a search query into sub queries?

I am just wondering if there is an algorithm that can divide a user input query for a search engine into a set of sub queries. for example if the entered query is "plcae to stay and eat" the sub ...

Is there a lighter version of Google Analytics for Flash

40k of compiled code seems like a lot to me to be making some straightforward flash-javascript calls and makes GA unsuitable for banner ad work as well. Does anyone know if there is a lite version ...

PHP GET question - calling from a POST call

I have a quick question i hope you guys can answer, i ve got a search system that uses POST to do searches, now i want to track queries using Google Analytics but it requires using GET url parameters ...

Google Analytics to track FireFox extension use

I m developing a Firefox extension and would like to track its use with google analytics, but I can t get it working. I ve tried manually calling a function from ga.js, but that didn t work for some ...

Google Analytics _trackEvent troubles

I m having some noob troubles with Google Analytics and _trackEvent. Using it seems straight forward in the documentation, but I can t get this simple example to work. The call to _trackEvent fails ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

热门标签