Motivation:

I had to use Google Analytics content group, and in order to do so I had to add ga('set',...) before the data is being sent to GA (e.g. ga('set', 'contentGroup1', 'Men');).

Solution:

I've added a new hook to called hook_googleanalytics_before_send_alter(&$script), which allows us to alter the script before it is being sent to google.
The new hook may be used in a various situations:

  1. set content groups
  2. set other page data
  3. ...

Thanks,
Rotem

Comments

rreiss created an issue. See original summary.

rreiss’s picture

rreiss’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: alter_the_script_before_being_sent-2613866-#1.patch, failed testing.

The last submitted patch, 2: alter_the_script_before_being_sent-2613866-#1.patch, failed testing.

The last submitted patch, 2: alter_the_script_before_being_sent-2613866-#1.patch, failed testing.

The last submitted patch, 2: alter_the_script_before_being_sent-2613866-#1.patch, failed testing.

hass’s picture

Status: Needs work » Closed (duplicate)
Issue tags: -drupal_alter
Parent issue: » #231451: Add hook to alter data before sending it to browser