...
Create a container
div
with an ID.Code Block <div id="EXAMPLE-ID"></div>
Import the script into your page. This script should be at the end of the body tag.
Code Block <script src="AUTOSYNC_API_URL/js/Autosync.js"></script>
Call the
AutosyncVisualizer
constructor. You must provide the API key and the container ID. Use object notation to provide the following values.
Code Block |
---|
--- ## Required |
...
id
– The ID of the containerkey
– The API key provided for you in the portal
Optional:
...
scrollBar
– Show or hide the visualizer’s scroll bar; by default it's set to false
...
productSegment
- Show only the interface for one product’s segment, it can be an array with more or a string for only one option, this are the valid values:
tires - Allows a tire’s brand page and a interface to see each tire by it self
wheels - Allows a wheel’s brand page and a interface to see each wheel by it self
accessories - Allows a accessory’s brand page and a interface to see each accessory by it self
vehicles - Allows the VOV (View on vehicle) Images for each of the others segments. Important: This segment can’t be set alone, must be set with other segment
startPage
- Use a segment page as home page. This are the valid values:
...
vehicles - It will use the Make’s page as home page
...
wheels - It will use the Wheel’s brands page as home page
...
tires - It will use the Tire’s brands page as home page
Any Path used on the visualizer - It should be an Path that already is available on the visualizer for example:
Code Block | ||
---|---|---|
| ||
/vehicles/Jeep
/vehicles/2023/Jeep/Gladiator
/tires/brands
/wheels/brands
.
.
.
etc |
IMPORTANT: Only paths that are already working on your visualizer can be configured here. If a Path that doesn’t exists is gave then the visualizer will not work properly. To get valid paths you can use your API Key on
Code Block |
---|
https://vvs.autosyncstudio.com/YOUR_API_KEY |
Then you will have an URL like this one:
Code Block |
---|
https://vvs.autosyncstudio.com/vehicle/2023/Acura/Integra |
And the path will be this part:
...
Parameters
### `id` (String)
**Description**: The ID of the visualizer element.
**Usage**: A unique identifier for the visualizer container in the DOM.
**Example**:
```javascript
id: 'autosync-visualizer'
```
---
### `key` (String)
**Description**: Your API key for authentication.
**Usage**: Ensure you replace `'YOUR_API_KEY'` with a valid API key.
**Example**:
```javascript
key: 'your-valid-api-key'
```
---
## Optional Parameters
### `adaptiveHeight` (Boolean)
**Description**: Adapts the iframe's height to the content inside.
**Default**: `false`
**Example**:
```javascript
adaptiveHeight: true
```
---
### `customStyleSheet` (String | null)
**Description**: Adds a custom stylesheet to modify the visualizer's style.
**Default**: `null`
**Example**:
```javascript
customStyleSheet: 'path/to/stylesheet.css'
```
---
### `disableQuoteForm` (Boolean)
**Description**: Disables the quote form after a user interaction with "Quote," "Buy," or "Add to Cart" buttons.
**Default**: `false`
**Example**:
```javascript
disableQuoteForm: true
```
---
### `homeStyle` (String | null)
**Description**: Determines the home layout style of the visualizer.
**Options**: `'lookup'`, `'segment_selection'`, `'vehicle_make_selection'`
**Default**: `null`
**Example**:
```javascript
homeStyle: 'lookup'
```
---
### `onEvent` (Function | null)
**Description**: A callback function triggered on specific events.
**Default**: `null`
**Example**:
```javascript
onEvent: ({ event, data }) => console.debug('Event triggered', event, data)
```
---
### `productSegment` (Array | String | null)
**Description**: Defines the product segments displayed in the visualizer.
**Options**: `'vehicles'`, `'tires'`, `'wheels'`, `'accessories'`
**Default**: `['vehicles', 'tires', 'wheels']`
**Important**: `'vehicles'` must be combined with at least one other option.
**Example**:
```javascript
productSegment: ['vehicles', 'wheels']
```
---
### `startPage` (String | null)
**Description**: Specifies the page where the visualizer will start.
**Options**: `'home'`, `'vehicles'`, `'tires'`, `'wheels'`
**Default**: `'home'`
**Example**:
```javascript
startPage: 'vehicles'
```
---
### `scrollBar` (Boolean)
**Description**: Enables or disables the scrollbar.
**Default**: `false`
**Example**:
```javascript
scrollBar: true
```
---
### `widget` (Boolean | Object)
**Description**: Configures additional widget features.
**Default**: `false`
**Details**: If an object is provided, the following properties are available:
- `sizesLookup` (Boolean): Enables size lookup.
- `brandsLookup` (Boolean): Enables brand lookup.
- `vehiclesLookup` (Boolean): Enables vehicle lookup.
- `redirectUrl` (String): URL to redirect the user after specific interactions.
- `styles` (String): CSS code for additional customization.
**Examples**:
Enable the widget:
```javascript
widget: true
```
Customize the widget:
```javascript
widget: {
sizesLookup: true,
brandsLookup: true,
vehiclesLookup: true,
redirectUrl: 'https://example.com',
styles: `
.autosync-visualizer {
background-color: #f8f9fa;
}
.lookup-tabs {
grid-template-columns: repeat(3, 1fr) !important;
}
`
}
```
---
## Complete Example Configuration
```javascript
var autosync = new Autosync({
id: 'autosync-visualizer',
key: 'YOUR_API_KEY',
adaptiveHeight: false,
customStyleSheet: null,
disableQuoteForm: false,
homeStyle: 'lookup',
onEvent: null,
productSegment: ['vehicles', 'wheels'],
startPage: 'vehicles',
scrollBar: false,
widget: {
sizesLookup: true,
brandsLookup: true,
vehiclesLookup: true,
redirectUrl: 'https://example.com',
styles: `
.autosync-visualizer {
background-color: #f8f9fa;
}
.lookup-tabs {
grid-template-columns: repeat(3, 1fr) !important;
}
`
}
});
``` |
Note |
---|
Each domain where the visualizer is embedded must be whitelisted in the settings of the API key used for the visualizer in the portal. |
...