customTask Builder | Simo Ahava . Blog – News Couple
ANALYTICS

customTask Builder | Simo Ahava . Blog


You can use the customTask generator File creation tool customTask script. customTask It is a method of the Google Analytics library, which allows you to run JavaScript code when creating a request to access Google Analytics.

Click here to go directly to the tool.

This is very useful for a number of reasons, and we recommend that you read it customTask Guide before doing anything with the tool.

The tool automatically generates the necessary JavaScript, avoiding any potential conflicts that otherwise nested methods might present.

When you add individual features to the script by selecting items in the table, you will see how the final script is modified accordingly.

When you are satisfied with the result, select all the text within the white icon box. You can also click File Copy to clipboard A button to automatically copy the code to your clipboard.

General Posting Instructions

When adding individual items to the script, you will notice that the first lines of the script contain default values ​​that you will need to modify. For example, when adding a file Customer ID as a custom component element, you will see these lines added to the code:

// clientIdIndex: The Custom Dimension index to where you want to send the visitor's Client ID.
// https://bit.ly/2Ms0ZcC  
var clientIdIndex = 1;

the value 1 It is just a default value – you will need to change this to the index of the custom component you created in Google Analytics for that specific purpose.

Thus after copying and pasting the code in place, make sure to edit all the default values ​​with the actual values ​​you want to configure the elements with. Otherwise, you will encounter serious data quality issues.

Publish with Google Tag Manager

If you are using Google Tag Manager, you will need to copy and paste the code into a file custom javascript variable. If you use the “Copy to clipboard (for GTM)” button, you don’t have to modify the JavaScript as shown below.

If, for some reason, you refuse to use the “Copy to clipboard (for GTM)” button, then after copying and pasting the contents into your custom JavaScript variable, you will need to modify the first line by removing var _customTask = part like this:

// OLD, CHANGE THIS:
var _customTask = function() {

// NEW, TO THIS:
function() {

The second change you have to make is Remove the semicolon at the end of the code block. In other words, remove the last character from the entire code block, which should be a semicolon ;.

Once you are done modifying the default values, save the variable with the name customTask Or something similar descriptive.

Next, in the Google Analytics settings variable, go to Fields to be set, and add a new field:

field name: customTask
Values: customTask

If you are not using the Google Analytics settings variant, you need to click Activate override settings in this tag In all Google Analytics tags where you want to add this customTask as a field, and make the same change directly to the tag itself.

Publishing with analytics.js

With the regular (legacy) Universal Analytics library, you first need to make sure the variable is written into memory, so in your JavaScript site (or page template) make sure the code is executed in the code box below before any Google Analytics commands are run.

Then, when you want to call this customTask In your trackers, find where the tracker was created and make the following change:

ga('create', 'UA-12345-1');

ga('set', 'customTask', _customTask()); // <-- Add this right after creating the tracker

ga('send', 'pageview');
Click to select the feature(s) to include
Customer ID as a custom component
Result type as custom component
Cargo length as custom dimension
Remove custom definitions from page speed timings
Copy visits to multiple properties
Remove personally identifiable information from the event
Copy visits to the snowplow complex’s end point
Update session cookie
Decorate Iframes across the field
Prevent duplicate transactions
Payload obfuscation and copying
Use localStorage to persist the client ID

|

summary

I hope you find this tool useful. I will try to update it when I get something new customTask Thoughts, which they often seem.

Please let me know in the comments if you are having trouble using the tool, or if you have a new one customTask Ideas you want to include in the tool in mind.



Source link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button