Segment has built a Tag Injector Destination to give Segment users the flexibility needed to load and configure client-side tools.
NOTE: Tag Injector is only available for select customers at this time.
The first step is to make sure Tag Injector supports the source type and connection mode you’ve chosen to implement. You can learn more about what dictates the connection modes we support here.
- Once you have access, with the link provided confirm the Source you’d like to connect to.
- You have the following configuration options which will manipulate the page at runtime:
srcattribute of the
- Merge Variable: A global variable that can be modified or created at runtime.
- You can also configure global variables, which the Tag Injector can manipulate in a user-specified way via Merge Variable tags. These Merge Variable tags support two fields:
- Variable Name indicates what global variable to operate on.
- Tag Value specifies what values should be merged into the global variable.
- For each Merge Variable tag, the Tag Injector will inject code which will have the behavior as follows. For this example, let us call the global variable with the name specified in Variable Name the global variable to modify.
- If the global variable to modify does not yet exist, it is created and initialized to the value described in Tag Value.
- If the global variable to modify already exists, its value is merged with the value described in Tag Value. This merging process will be implemented via a custom function.
analytics.js. Be sure that the script you have configured performs the desired task and does not break your page. You should mitigate any risks by assuring the script injected via the Tag Injector will be QA’d for correctness and security.
How do I know what tags were injected by the Tag Injector?
You will be able to distinguish tags loaded via Segment’s Tag Injector through the
data-injected-by="segment" attribute on the tag.
Script injection location and ordering
The Tag Injector will always inject the configured tags as
<script> elements inserted into the document’s
<script> elements will be inserted in the order they are defined in the Tag Injector settings.