Send an event once per pageView

Silver Contributor
Silver Contributor

This is the situation:  I want to send a certain data ('someData') to Google Analytics when loading a certain page (for example, if the URL parameter 'qp' = 'someValue'). So I configured a Set Data Value Extension by filling in a variable 'someVar' with the trigger "if 'qp' = 'someValue'" and then in Google Analytics Tag I map this variable. So:

Set Data Value Extension --->  Set: 'someVar' to 'someData' - Condition: 'qp' equals 'someValue'

Google Analytics Tag ---> Map 'someVar'


This is the problem: The data is sent many times in a single page load. Even if you click or trigger another event on the same page, the data is sent again. But I want to send it only once. ¿How could I do it?

Thanks a lot. Best regards,



Send an event once per pageView

Employee Emeritus

Hi @iMettrics ,

Without being able to investigate the site, there are some options that you can try. 


1. If the event should be firing on a view or link event, you can add a condition that the Set Data Values only sets when ut.event = view or link.


2. Create a javascript extension that sets the values and check the "Run Once" flag.  You will want to leverage the 'b' object in this case. For example:

b.someVar = "event"

condition, when qp is defined.

3. Persist a boolean cookie that starts off as false. Then when the qp is available, set your value and set the cookie to true, with the condition that the Set Data Values extension only runs when the cookie is false.


someVar = 'event'

cookie = true

condition: When qp is defined and cookie === false.


Let me know if this helps. Good luck!

Send an event once per pageView

Bronze Contributor
Bronze Contributor


Use b object in this case.
For example:

b.someNewVar = true
Set: 'someVar' to 'someData' - Condition: 'qp' equals 'someValue'

once pixel get fire on page load, change the value of newly created variable in b object

b.someNewVar = false