Example #1
0
 advs();
 ?>
 			
 			<div>
   			<input type="submit" value="Expand everything" class="expandall btn btn-default" id="expandallbottom" style="margin:10px"/>&nbsp;&nbsp;&nbsp;
   			<input type="submit" value="Shrink everything" class="contractall btn btn-default" id="contractallbottom" style="margin:10px"/>
   	  </div>
 	<?php 
 $assetRe = "/\\/containers\\/\\d+\\/(tags|triggers|variables)\\/(\\d+)/";
 $assetArray = [];
 $autoAsset = [];
 preg_match_all($assetRe, $contRef, $assetArray);
 if (!empty($assetArray[1])) {
     switch ($assetArray[1][0]) {
         case 'tags':
             $autoAsset = findTagById($assetArray[2][0]);
             echo "<script>";
             echo "jQuery('#tags').show();";
             echo "jQuery('#tagType" . $autoAsset['type'] . "').next().show();";
             echo "jQuery('#tag" . $autoAsset['tagId'] . "').next().show();";
             echo "document.location.href = '#tag" . $autoAsset['tagId'] . "';";
             echo "</script>";
             break;
         case 'triggers':
             $autoAsset = findTrigById($assetArray[2][0]);
             echo "<script>";
             echo "jQuery('#trigs').show();";
             echo "jQuery('#trigType" . $autoAsset['type'] . "').next().show();";
             echo "jQuery('#trig" . $autoAsset['triggerId'] . "').next().show();";
             echo "document.location.href = '#trig" . $autoAsset['triggerId'] . "';";
             echo "</script>";
Example #2
0
function trigDetail($trig, $typeString = '', $event = '')
{
    global $usedTriggers, $untaggedTriggers, $tagTypes, $tagLibrary;
    $deets = '<h3>Details for trigger <i>' . $trig['name'] . '</i></h3>';
    $deets = $deets . '<a href="https://tagmanager.google.com/#/container/accounts/' . $trig['accountId'] . '/containers/' . $trig['containerId'] . '/triggers/' . $trig['triggerId'] . '"';
    $deets = $deets . ' style="position:relative;float:right;top:-40px;right:10px;" class="triggerEdit">edit</a>';
    $deets = $deets . '<table class="table table-bordered table-striped">';
    $deets = $deets . '<tr><th>Name</th><td>' . $trig['name'] . '</td></tr>';
    $deets = $deets . '<tr><th>Type</th><td>' . $typeString . '</td></tr>';
    $deets = $deets . '<tr><th>How it works</th><td>';
    if ($trig['type'] === 'FORM_SUBMISSION' || $trig['type'] === 'LINK_CLICK') {
        $action = $trig['type'] === 'FORM_SUBMISSION' ? 'submit' : 'click';
        $deets = $deets . listeningOn($trig, $action);
        $deets = $deets . $event;
        $deets = $deets . firingOn($trig);
        $deets = $deets . waitAndValidate($trig, $action);
        $deets = $deets . '</td></tr>';
    } else {
        $deets = $deets . $event;
        $deets = $deets . firingOn($trig);
    }
    $deets = $deets . '<tr><th>Where it\'s used</th>';
    if (array_search($trig['triggerId'], $usedTriggers) === false) {
        $deets = $deets . '<td>This trigger isn\'t used anywhere...</td>';
        array_push($untaggedTriggers, $trig);
    } else {
        $firing = '';
        $blocking = '';
        $tTag = [];
        foreach ($tagTypes as $ttKey => $ttVal) {
            foreach ($tagLibrary[$ttVal] as $tKey => $tag) {
                if (array_key_exists('firingTriggerId', $tag)) {
                    foreach ($tag['firingTriggerId'] as $ftKey => $ftVal) {
                        if ($trig['triggerId'] === $ftVal) {
                            $tTag = findTagById($tag['tagId']);
                            $firing = $firing . '<li><a href="#tag' . $tTag['tagId'] . '" id="ft' . $tTag['tagId'] . '" data-asset="tag" data-index=' . $tTag['tagId'] . ' data-type=' . $tTag['type'] . ' class="Detail">' . $tTag['name'] . '</a></li>';
                        }
                    }
                }
                if (array_key_exists('blockingTriggerId', $tag)) {
                    foreach ($tag['blockingTriggerId'] as $btKey => $btVal) {
                        if ($trig['triggerId'] === $btVal) {
                            $tTag = findTagById($tag['tagId']);
                            $blocking = $blocking . '<li><a href="#tag' . $tTag['tagId'] . '" id="bt' . $tTag['tagId'] . '" data-asset="tag" data-index=' . $tTag['tagId'] . ' data-type=' . $tTag['type'] . ' class="Detail">' . $tTag['name'] . '</a></li>';
                        }
                    }
                }
            }
        }
        if ($firing !== '' || $blocking !== '') {
            $deets = $deets . '<td>';
            if ($firing !== '') {
                $deets = $deets . 'This trigger is used by the following tags as a firing trigger:<ul>' . $firing . '<br /></ul>';
            }
            if ($blocking !== '') {
                $deets = $deets . 'This trigger is used by the following tags as a blocking trigger:<ul>' . $blocking . '</ul>';
            }
            $deets = $deets . '</td></tr>';
        }
    }
    $deets = $deets . '<tr><th>Where it lives</th>';
    if (array_key_exists('parentFolderId', $trig)) {
        $deets = $deets . '<td>' . folderisation($trig['parentFolderId'], 'trigger') . '</td></tr>';
    } else {
        $deets = $deets . '<td>' . folderisation(null, 'trigger') . '</td></tr>';
    }
    $deets = $deets . '</table>';
    return $deets;
}