Currently, other than appending the Google Analytics code to the affiliate.example.com/example_page.html
page, for tracking to work you should also set the SameSite=None
attribute for the GA cookies (if this is acceptable to you). One way to achieve it is by using cookie_flags
configuration option in gtag
inside an iframe:
gtag('config', 'G-N2A3FMNDT5', {
cookie_flags: 'max-age=7200;secure;samesite=none'
});
Otherwise, the events will not be sent from the iframe.
More details about this solution can be found in this article: https://www.simoahava.com/analytics/cookieflags-field-google-analytics/