Skip to content

Commit 492ce63

Browse files
committed
Removing 'document.currentScript' from code after confirming Firefox bug fix. Also adding verbiage around pairing events with insert methods.
1 parent 675fab2 commit 492ce63

File tree

8 files changed

+662
-662
lines changed

8 files changed

+662
-662
lines changed

source/includes/_debugging.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
55
```javascript
66
(async APILoader => {
7-
const API = await APILoader.create(document.currentScript);
8-
API.subscribe('page-load-v1', ev => {
9-
if (ev.payload.searchPage) {
10-
API.log('My integration has loaded and this is a search results page.');
11-
}
12-
});
7+
const API = await APILoader.create();
8+
API.subscribe('page-load-v1', ev => {
9+
if (ev.payload.searchPage) {
10+
API.log('My integration has loaded and this is a search results page.');
11+
}
12+
});
1313
})(window.DDC.APILoader);
1414
```
1515

@@ -27,4 +27,4 @@ This will output more information about the actions being taken in your script t
2727

2828
Additionally, you can instrument your own integration with log messages to validate that the expected code is being executed and desired code paths are being followed.
2929

30-
To log messages from within your integration code, simply use the `API.log` method the same way you would use `console.log`. Those messages will be output to your console when the above URL parameter is present and will be suppressed when it is not.
30+
To log messages from within your integration code, simply use the `API.log` method the same way you would use `console.log`. Those messages will be output to your console when the above URL parameter is present and will be suppressed when it is not.

source/includes/_events.md

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ There are currently three types of events and each has a consistent data format.
1212
1313
```javascript
1414
{
15-
accountId: 'futuredemodealer',
16-
siteId: 'futuredemodealer',
17-
defaultDomain: 'www.roimotors.com',
18-
indexPage: true,
19-
searchPage: false,
20-
detailPage: false,
21-
franchises: ['honda'],
22-
design: {
23-
variationId: 'v9_GLOBAL_0011_V2',
24-
themekit: 'BLUE_WHITE'
25-
},
26-
pageName: 'INDEX',
27-
layoutType: 'desktop',
28-
locale: 'en_US'
15+
accountId: 'futuredemodealer',
16+
siteId: 'futuredemodealer',
17+
defaultDomain: 'www.roimotors.com',
18+
indexPage: true,
19+
searchPage: false,
20+
detailPage: false,
21+
franchises: ['honda'],
22+
design: {
23+
variationId: 'v9_GLOBAL_0011_V2',
24+
themekit: 'BLUE_WHITE'
25+
},
26+
pageName: 'INDEX',
27+
layoutType: 'desktop',
28+
locale: 'en_US'
2929
}
3030
```
3131

@@ -49,21 +49,21 @@ Field Key | Example Value | Field Format
4949
5050
```javascript
5151
{
52-
dealershipName: 'ROI Motors',
53-
dealershipAddress1: '1 Howard Street',
54-
dealershipAddress2: '',
55-
dealershipCity: 'Burlington',
56-
dealershipCodes: {
57-
'dealertrack-post': 'futuredemodealer',
58-
dtid: '12345',
59-
'dt-dr-profile': 'futuredemodealer',
60-
affiliate_promotions: 'avis',
61-
'at-kbb': '12345678'
62-
},
63-
dealershipFranchises: ['honda'],
64-
dealershipPostalCode: '05401',
65-
dealershipStateProvince: 'VT',
66-
dealershipCountry: 'US'
52+
dealershipName: 'ROI Motors',
53+
dealershipAddress1: '1 Howard Street',
54+
dealershipAddress2: '',
55+
dealershipCity: 'Burlington',
56+
dealershipCodes: {
57+
'dealertrack-post': 'futuredemodealer',
58+
dtid: '12345',
59+
'dt-dr-profile': 'futuredemodealer',
60+
affiliate_promotions: 'avis',
61+
'at-kbb': '12345678'
62+
},
63+
dealershipFranchises: ['honda'],
64+
dealershipPostalCode: '05401',
65+
dealershipStateProvince: 'VT',
66+
dealershipCountry: 'US'
6767
}
6868
```
6969

@@ -85,60 +85,60 @@ Field Key | Example Value | Field Format
8585
8686
```javascript
8787
{
88-
accountId: 'futuredemodealer',
89-
address: {
90-
accountName: 'ROI Motors',
91-
city: 'Burlington',
92-
state: 'VT',
93-
postalCode: '05401',
94-
country: 'US'
95-
},
96-
autodataCaId: '1234567',
97-
bodyStyle: 'SUV',
98-
certified: false,
99-
chromeId: '411601',
100-
cityFuelEconomy: 28,
101-
classification: 'primary',
102-
dealerCodes: {
103-
'dealertrack-post': 'futuredemodealer',
104-
dtid: '12345',
105-
'dt-dr-profile': 'futuredemodealer',
106-
affiliate_promotions: 'avis',
107-
'at-kbb': '12345678'
108-
},
109-
driveLine: 'Front-wheel Drive',
110-
engine: 'I-4 cyl',
111-
engineSize: '1.5L',
112-
exteriorColor: 'Crystal Black Pearl',
113-
finalPrice: 32000,
114-
fuelType: 'Regular Unleaded',
115-
highestPrice: 34500,
116-
highwayFuelEconomy: 34,
117-
images: [
118-
'https://pictures.dealer.com/f/futuredemodealer/1182/0686eb936bd7a4905f751493cc28dcb9x.jpg'
119-
],
120-
internetPrice: 33000,
121-
interiorColor: 'White',
122-
inventoryType: 'new',
123-
link: 'https://www.roimotors.com/new/Honda/2020-Honda-Accord-burlington-ab119e0e0a0a00f944d6f3031cd34854.htm',
124-
make: 'Honda',
125-
model: 'CR-V',
126-
modelCode: 'RW1H9LKNW',
127-
msrp: 34000,
128-
odometer: 3,
129-
optionCodes: [
130-
'ABC',
131-
'123',
132-
'321'
133-
],
134-
startingPrice: 34000,
135-
status: 'live',
136-
stockNumber: '00100060',
137-
transmission: 'Variable',
138-
trim: 'Touring 2WD',
139-
uuid: 'ab119e0e0a0a00f944d6f3031cd34854',
140-
vin: '1HGCV1F42JA141468',
141-
year: 2020
88+
accountId: 'futuredemodealer',
89+
address: {
90+
accountName: 'ROI Motors',
91+
city: 'Burlington',
92+
state: 'VT',
93+
postalCode: '05401',
94+
country: 'US'
95+
},
96+
autodataCaId: '1234567',
97+
bodyStyle: 'SUV',
98+
certified: false,
99+
chromeId: '411601',
100+
cityFuelEconomy: 28,
101+
classification: 'primary',
102+
dealerCodes: {
103+
'dealertrack-post': 'futuredemodealer',
104+
dtid: '12345',
105+
'dt-dr-profile': 'futuredemodealer',
106+
affiliate_promotions: 'avis',
107+
'at-kbb': '12345678'
108+
},
109+
driveLine: 'Front-wheel Drive',
110+
engine: 'I-4 cyl',
111+
engineSize: '1.5L',
112+
exteriorColor: 'Crystal Black Pearl',
113+
finalPrice: 32000,
114+
fuelType: 'Regular Unleaded',
115+
highestPrice: 34500,
116+
highwayFuelEconomy: 34,
117+
images: [
118+
'https://pictures.dealer.com/f/futuredemodealer/1182/0686eb936bd7a4905f751493cc28dcb9x.jpg'
119+
],
120+
internetPrice: 33000,
121+
interiorColor: 'White',
122+
inventoryType: 'new',
123+
link: 'https://www.roimotors.com/new/Honda/2020-Honda-Accord-burlington-ab119e0e0a0a00f944d6f3031cd34854.htm',
124+
make: 'Honda',
125+
model: 'CR-V',
126+
modelCode: 'RW1H9LKNW',
127+
msrp: 34000,
128+
odometer: 3,
129+
optionCodes: [
130+
'ABC',
131+
'123',
132+
'321'
133+
],
134+
startingPrice: 34000,
135+
status: 'live',
136+
stockNumber: '00100060',
137+
transmission: 'Variable',
138+
trim: 'Touring 2WD',
139+
uuid: 'ab119e0e0a0a00f944d6f3031cd34854',
140+
vin: '1HGCV1F42JA141468',
141+
year: 2020
142142
}
143143
```
144144

@@ -221,10 +221,10 @@ To receive data for events, you must opt-in to event subscriptions. Each event i
221221
222222
```javascript
223223
(async APILoader => {
224-
const API = await APILoader.create(document.currentScript);
225-
API.subscribe('page-load-v1', ev => {
226-
API.log(ev);
227-
});
224+
const API = await APILoader.create();
225+
API.subscribe('page-load-v1', ev => {
226+
API.log(ev);
227+
});
228228
})(window.DDC.APILoader);
229229

230230
```
@@ -244,10 +244,10 @@ The page load event is useful to determine the context of the current page. By m
244244
245245
```javascript
246246
(async APILoader => {
247-
const API = await APILoader.create(document.currentScript);
248-
API.subscribe('dealership-info-v1', ev => {
249-
API.log(ev);
250-
});
247+
const API = await APILoader.create();
248+
API.subscribe('dealership-info-v1', ev => {
249+
API.log(ev);
250+
});
251251
})(window.DDC.APILoader);
252252

253253
```
@@ -267,10 +267,10 @@ The dealership info event is useful if you need to know the name and address of
267267
268268
```javascript
269269
(async APILoader => {
270-
const API = await APILoader.create(document.currentScript);
271-
API.subscribe('vehicle-shown-v1', ev => {
272-
API.log(ev);
273-
});
270+
const API = await APILoader.create();
271+
API.subscribe('vehicle-shown-v1', ev => {
272+
API.log(ev);
273+
});
274274
})(window.DDC.APILoader);
275275
```
276276

@@ -291,11 +291,11 @@ On a vehicle deals page, a single event is fired because you are viewing a singl
291291
292292
```javascript
293293
(async APILoader => {
294-
const API = await APILoader.create(document.currentScript);
295-
API.subscribe('vehicle-data-updated-v1', data => {
296-
API.log(data.payload.pageData); // Outputs the Page Data object to the console.
297-
API.log(data.payload.vehicleData); // Outputs the updated Vehicle Data object to the console.
298-
});
294+
const API = await APILoader.create();
295+
API.subscribe('vehicle-data-updated-v1', data => {
296+
API.log(data.payload.pageData); // Outputs the Page Data object to the console.
297+
API.log(data.payload.vehicleData); // Outputs the updated Vehicle Data object to the console.
298+
});
299299
})(window.DDC.APILoader);
300300
```
301301

source/includes/_internal.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ The attributes that can be modified are `href`, `target`, `onclick`, `popover` a
1717
1818
```javascript
1919
(async APILoader => {
20-
const API = await APILoader.create(document.currentScript);
20+
const API = await APILoader.create();
2121
API.updateLink('x-time', meta => {
22-
return {
23-
href: 'https://www.yourdomain.com/?account=' + meta.accountId,
24-
target: '_blank',
25-
}
22+
return {
23+
href: 'https://www.yourdomain.com/?account=' + meta.accountId,
24+
target: '_blank',
25+
}
2626
});
2727
})(window.DDC.APILoader);
2828
```
@@ -37,41 +37,41 @@ This method allows you to modify content on a page level. Right now we only supp
3737
3838
```javascript
3939
(async APILoader => {
40-
const API = await APILoader.create(document.currentScript);
41-
API.modifyContent('schedule-service', {
42-
schema: {
43-
// Attributes of the link you want to add or modify
44-
}
45-
});
40+
const API = await APILoader.create();
41+
API.modifyContent('schedule-service', {
42+
schema: {
43+
// Attributes of the link you want to add or modify
44+
}
45+
});
4646
})(window.DDC.APILoader);
4747
```
4848

4949
> Schema Object:
5050
5151
```javascript
5252
{
53-
"href": "String", // Link to a new service page
54-
"target": "String", // Set the target attribute of the anchor tag
55-
"onclick": "Function", // Set an onClick event handler for the button. Remember to reset the href of the button while setting a click event.
56-
"popover": "Object", // Popover settings for your button, eg {title: "heading", content: "popover text"}
57-
"attributes": "Object" // List of all data attributes that you would want to add to the button
53+
"href": "String", // Link to a new service page
54+
"target": "String", // Set the target attribute of the anchor tag
55+
"onclick": "Function", // Set an onClick event handler for the button. Remember to reset the href of the button while setting a click event.
56+
"popover": "Object", // Popover settings for your button, eg {title: "heading", content: "popover text"}
57+
"attributes": "Object" // List of all data attributes that you would want to add to the button
5858
}
5959
```
6060

6161
> Example Implementation:
6262
6363
```javascript
6464
(async APILoader => {
65-
const API = await APILoader.create(document.currentScript);
66-
API.modifyContent('schedule-service', {
67-
schema: {
68-
"href": "/schedule-form.htm",
69-
"target": "_blank",
70-
"attributes": {
71-
"data-width": "400px",
72-
"data-title": "My custom service"
73-
}
74-
}
75-
});
65+
const API = await APILoader.create();
66+
API.modifyContent('schedule-service', {
67+
schema: {
68+
"href": "/schedule-form.htm",
69+
"target": "_blank",
70+
"attributes": {
71+
"data-width": "400px",
72+
"data-title": "My custom service"
73+
}
74+
}
75+
});
7676
})(window.DDC.APILoader);
7777
```

0 commit comments

Comments
 (0)