You may sometimes want to generate a new event whenever an existing event is triggered with specific parameter values. For example, if you want to register a key event whenever a user lands on a confirmation page, you can generate a new custom event called, for example, confirm_signup
whenever the page_view
event occurs with a page_location
parameter value that matches your confirmation page URL. Then, you would mark the confirm_signup
event as a key event.
You can also change an existing event, for example rename it or its parameters. This allows you to fix measurement errors caused by a typo in an event's name, conditions, or parameters.
Limits & caveats
- Modified and new events do not apply to historical data.
- You can modify up to 50 existing events and create up to 50 events based on existing events.
- An hour or more passes before modifications take effect.
- Modifications are calculated client side (before data is sent to Analytics).
-
You can't generate or modify events based on parameters from the items array (e.g.,
item_brand
,item_name
,item_id
) when you usegtag.js
. -
You can't modify events if you send them in a server-to-server setup, for example, when you use Measurement Protocol.
Before you begin
Before you generate a new event or rename an existing event:
- Make sure that the new name is not a reserved name
- Review the changes with your team so you don't duplicate event names
- Review the event collection limits
Instructions
If you have multiple streams connected to your Google Analytics property, you will be asked to choose which stream you want to create or modify your events in.
Generating an event copies over an existing event into a new event with the parameters from the existing event plus any new parameters you specify.
- In Admin, under Data display, click Events.
Note: The previous link opens to the last Analytics property you accessed. You can change the property using the property selector. You must be an Editor or above at the property level to generate an event from an existing event. If you don't see the Create event button in the top right of the table, then you don't have the required role to create events.
- Click Create event, then click Create.
- In Custom event name, enter an event name that conforms to the event naming rules.
- In Matching conditions, specify one or more matching conditions. Google Analytics will copy over any event that matches the conditions you specify. For example, if you specify "event_name equals view_item", Analytics will copy over view_item to your new event.
To define a condition to be case sensitive, use one of the operators that does not include the text "(ignore case)". For example, use "equals" instead of "equals (ignore case)" if you want the parameter to exactly match the value.
Before you use a regular expression in a matching condition, review the best practices. - (Optional) By default, Copy parameters from the source event is enabled to use the parameters from the matching event. To turn off this feature, click Copy parameters from the source event.
- (Optional) In Modify parameters, change any of the parameters from the matching event that you've copied over to the new event. For example, if you specify the view_item event in matching conditions, then you could modify the currency parameter. Learn more
Note: You cannot apply mathematical operations to events using the event builder. Instead, you need to send the updated value in a new event.
- Click Create.
Modifying an event overwrites an existing event by adding, changing, or removing parameters. Modified events are processed before created events are processed.
- In Admin, under Data display, click Events.
Note: The previous link opens to the last Analytics property you accessed. You can change the property using the property selector. You must be an Editor or above at the property level to modify an existing event. If you don't see the Modify event button in the top right of the table, then you don't have the required role to modify events.
- Click Modify event, then click Create.
- In Modification name, enter a name that describes the changes.
- In Matching conditions, specify one or more matching conditions. You will be able to modify the event that has one or more event parameter that match all the conditions you specify. For example, if you specify "event_name equals view_item", you will be able to modify the view_item event.
To define a condition to be case sensitive, use one of the operators that does not include the text "(ignore case)". For example, use "equals" instead of "equals (ignore case)" if you want the parameter to exactly match the value.
Before you use a regular expression in a matching condition, review the best practices. - In Modify parameters, change any of the parameters from the matching event. Here are some examples of the modifications you can do.
Note: You cannot apply mathematical operations to events using the event builder. Instead, you need to send the updated value in a new event.
- Click Create.
Modified events execute in the order they appear in the Event modifications list.
Event modifications are applied to your data in the order they appear in the modifications list. This order can be important if you have modifications that rely on each other.
For example, if you rename an event in Modification 1 and use that new name as the basis for creating another event in Modification 2, then you need the modifications to execute in the order of Modification 1 > Modification 2. If those modifications are listed out of order, then Modification 2 will fail.
To reorder event modifications:
- In Admin, under Data display, click Events.
Note: The previous link opens to the last Analytics property you accessed. You can change the property using the property selector. You must be an Editor or above at the property level to reorder your modified events. If you don't see the Modify event button in the top right of the table, then you don't have the required role to modify events.
- Click Modify event.
- In the Event modifications pane, click Reorder.
- Drag a modification from one position in the list to another as needed.
- Click Apply.
- In Admin, under Data display, click Events.
Note: The previous link opens to the last Analytics property you accessed. You can change the property using the property selector. You must be an Editor or above at the property level to edit one of your generated or modified events. If you don't see the Create event button in the top right of the table, then you don't have the required role to create events.
- Click Create event.
- In the Custom events table, select the event to modify.
- Adjust the conditions and parameters as needed.
- Click Save.
Examples
Modify an existing event
The following example shows how to rename pub_article
to publish_article
. For all data collected after this change, publish_article
will appear in reports instead of pub_article
.
Modify event
Modification name
Change pub_article to publish_article |
Matching conditions
Parameter | Operator | Value |
event_name | equals | pub_article |
Modify parameters
Parameter | New value |
event_name | publish_article |
Generate a new event from an existing event
Generate a new event when you need to trigger an event based on conditions, but you don't want any existing events to change. Create a new event as described in the instructions on how to Generate a new event from an existing event.
For example, suppose the existing article_scroll
event is triggered when a visitor scrolls to read a complete article on a website. To have separate reporting on scrolls of the product page (product.html
), you could generate a new product_scroll
event. Both article_scroll
and product_scroll
will appear in reports, for all data collected after the new event triggers.
Create event
Custom event name
product_scroll |
Matching conditions
Parameter | Operator | Value |
event_name | equals | article_scroll |
page_location | Contains (Ignore case) | product |
Trigger an event based on a value
Identify the existing event or parameter you want to use as the trigger for your new event.
Let's say you want to create a custom event called "large_purchase" whenever a purchase
event is sent with a value of $100 or more.
- Enter "large_purchase" as the Custom event name.
- Enter the matching conditions.
- Copy the original event's parameters to the new event.
Custom event name
large_purchase |
Matching conditions
Parameter | Operator | Value |
event_name | equals | purchase |
value | greater than or equal to | 100 |
Parameter configuration
Copy parameters from the source event
In this example, the original purchase
event remains, and your new "large_purchase" event is also logged when the value of the purchase
event is greater than or equal to 100.
Modify parameters
Open an event as described in the instructions on how to modify an existing event:
Change a parameter value
To change an event parameter value, select the parameter in the Parameter field, then enter the value you want to use in the New value field. For example, to change the value of level_name to "Scary dungeon", select the level_name parameter, then enter the new value:
Parameter | New value |
level_name | Scary dungeon |
Copy a parameter value
You can replace one parameter's value with another parameter's value. To do this, enter the other parameter's name enclosed in double brackets in the New value field.
Parameter | New value |
level_name | [[other_parameter]] |
For example, suppose you find a typo in a parameter name: instead of level_name, an event was implemented with a lvl_name parameter. You can fix this by first copying the misspelled parameter to the correct parameter.
Parameter | New value |
level_name |
[[lvl_name]] |
Note: To use this feature, don't add text outside of the square brackets (for example, "[[lvl_name]] other text" won't work).
Remove an event parameter
You can delete parameters you don't need or want. To do this, set the parameter value to blank.
Parameter | New value |
lvl_name |