Use customTask and Universal Analytics

1. Use customTask Builder to send the same GA hit to multiple Google Analytics properties, like Roll-Up and Local properties, without having to duplicate tags.

Select Copy Hits to Multiple Properties in customTask Builder. Copy the code and paste it into a new Custom JavaScript variable created in Google Tag Manager. Add the Universal Analytics tracking IDs where you want to send the duplicated payload to the duplicateHitToTrackingIds array and save the variable. Add this variable to the tag you want to duplicate under Fields to Set using the field name customTask and the value set to the variable you just created.

2. Select Remove PII from Hits in customTask Builder to clear personally identifiable information from the entire Google Analytics payload.

Copy the code and paste it into a Custom JavaScript variable created in Google Tag Manager. Add new objects as instructed in the copy-pasted code to the piiRegEx array, each with a name describing the redaction and a regular expression containing the pattern to redact. The example preloaded into the copy-pasted code includes a simple email address pattern check. Add the variable you created above to the tag whose data you want to redact under Fields to Set using the field name customTask and the value set to the variable you just created.

3. Select Client ID as a Custom Dimension and Hit Type as a Custom Dimension in customTask Builder to enrich Google Analytics hits with useful metadata from the Google Analytics tracker.

Copy the generated code and paste it into a Custom JavaScript variable. Set the custom dimension indices to their respective variables (clientIdIndex, hitTypeIndex) as instructed in the copy-pasted code. Add the Custom JavaScript variable to the tag whose data you want to enrich under Fields to Set using the field name customTask and the value {{your customTask variable}}.

4. Select Prevent Duplicate Transactions in customTask Builder to prevent Universal Analytics collecting duplicate transactions.

Copy the generated code and paste it into a Custom JavaScript variable. Configure the cookie name and expiration in the transactionDeduper variable. Add this variable to the Enhanced Ecommerce Purchase tag under Fields to Set using the field name customTask and the value {{your customTask variable}}.

5. Select Update Session Cookie in customTask Builder to create a session cookie in the browser to mimic the session length calculated by Universal Analytics.

Copy the generated code and paste it into a Custom JavaScript variable. Update expiration (30 minutes by default) and domain name to write the cookie on. Add this variable to your Universal Analytics tags under Fields to Set using the field name customTask and the value {{your customTask variable}}.

6. Use a Google Analytics Settings Variables to share a customTask across your Google Analytics tags.

Navigate to Variables > New > Variable Configuration in Google Analytics and create a Settings variable. Add a new field using named customTask under Fields to Set and set the value to the customTask variable you want to share across the tags. Add the Google Analytics Settings variable to the Google Analytics tags you want to share customTask with.

7. Use customTask Builder to combine multiple customTasks into one.

Create a new Custom JavaScript variable in Google Tag Manager to use as your customTask variable. Open customTask Builder and select all the customTasks you want to combine. Copy the resulting code and paste it into the Custom JavaScript variable you created in Google Tag Manager Only a single customTask field can be set in any tag (or Google Analytics Settings variable). So, it’s important to use the Builder to combine all the different customTasks you want to set into a single code block.