PageSourceSearch

https://www.toyota.com/content/dam/global_files/scripts/adobe_target/config/targetConfig_tcom.js

js toyota.com collected 2026-09-24 07:49:21 UTC 3,805 bytes, 133 lines download raw bytes

1// Target Configuration Toyota
2// disable target when performance cookies are not allowed
3// PUWYLO updates 2023-07-07
4(function (window) {
5  const cnPerf = 'TOYOTANATIONAL_ENSIGHTEN_PRIVACY_FunctionalCookies';
6
7  function readCookie(name) {
8    if (!name) return null;
9    const prefix = encodeURIComponent(name) + '=';
10    const parts = document.cookie ? document.cookie.split(';') : [];
11    for (const part of parts) {
12      let segment = part.trim();
13      if (segment.startsWith(prefix)) {
14        return decodeURIComponent(segment.slice(prefix.length));
15      }
16    }
17    return null;
18  }
19
20  function allowsPerformanceCookies() {
21    const val = readCookie(cnPerf);
22    return val !== '0';
23  }
24
25  window._dL = window._dL || {};
26  const dl = window._dL;
27  dl.pageConfig = dl.pageConfig || {};
28  dl.pageConfig.target = dl.pageConfig.target || {};
29  const targetProps = dl.pageConfig.target;
30  window.targetGlobalSettings = {
31    bodyHidingEnabled: targetProps.bodyHidingEnabled || false,
32    enabled: allowsPerformanceCookies(),
33  };
34
35  const strip = (str = '') =>
36    (str || '').toLowerCase().replace(/[^a-z0-9]/g, '');
37  const dgAccum = (map, entry) => {
38    const key = strip(entry?.detail?.title);
39    map[key] = key;
40    return map;
41  };
42  const snapAccum = (map, entry) => {
43    const key = strip(entry?.detail?.model);
44    map[key] = key;
45    return map;
46  };
47
48  window.targetPageParams = function () {
49    const dl = window._dL || {};
50    const page = dl.page || {};
51    const config = dl.pageConfig || {};
52    const target = config.target || {};
53    // PUWYLO
54    const puwylo = {
55      hasSaves: false,
56      hasSnapshots: false,
57      shouldShow: false,
58      savedModels: '',
59      snapshotModels: '',
60    };
61
62    try {
63      const pu = JSON.parse(window.localStorage.getItem('UAT_REPORTER'));
64      // pu.applications.bap.history.snapshots.all.entrances
65      if (pu && pu.applications) {
66        const bap = (pu.applications || {}).bap || {};
67        const { history = {}, dg_bap = [] } = bap;
68        const entrances = ((history.snapshots || {}).all || {}).entrances || [];
69        puwylo.hasSaves = dg_bap.length > 0;
70        puwylo.hasSnapshots = entrances.length > 0;
71        puwylo.shouldShow = puwylo.hasSnapshots || puwylo.hasSaves;
72
73        if (puwylo.hasSaves) {
74          puwylo.savedModels = Object.keys(dg_bap.reduce(dgAccum, {})).join(
75            ','
76          );
77        }
78        if (puwylo.hasSnapshots) {
79          puwylo.snapshotModels = Object.keys(
80            entrances.reduce(snapAccum, {})
81          ).join(',');
82        }
83      }
84    } catch (e) {
85      console.log('Cannot send PUWYLO to Target', e);
86    }
87
88    return {
89      at_property: target.at_property,
90      ...page,
91      ...puwylo,
92    };
93  };
94})(window);
95
96document.addEventListener('at-request-succeeded', function (event) {
97  window.ttMETA = typeof window.ttMETA != 'undefined' ? window.ttMETA : [];
98  if (event && event.detail) {
99    const tokens = event.detail.responseTokens;
100    const exps = {}
101    if (tokens && tokens.length > 0) {
102      tokens.forEach(function (token) {
103        const { 
104            'activity.name': 
105            campaign, 'experience.name': 
106            recipe, 'activity.id': 
107            CampaignId, 'experience.id': 
108            RecipeId, 'offer.id': 
109            OfferId, 'offer.name': 
110            OfferName 
111        } = token;
112        // dedupe by campaign/recipe
113        if (campaign && recipe) {
114          exps[campaign] = {
115            campaign,
116            recipe,
117            token,
118          }
119        }
120        window.ttMETA.push({
121          CampaignName: campaign,
122          CampaignId,
123          RecipeName: recipe,
124          RecipeId,
125          OfferId,
126          OfferName,
127        });
128      });
129    }
130
131    window.mboxRecipe = Object.values(exps);
132  }
133});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.