Skip to content

Location Report (SDK)

New
Available in the US and Canada

The Location Report provides a comprehensive summary of scores, points of interest, demographics, and more, for any location in the US or Canada. The report can be shared by URL or printed as a PDF.

The SDK provides a pre-built UI for launching or downloading the report. This is ideal for clients wanting to get setup quickly.

Screenshot of new Local Content SDK's onboarding interface

Getting started

Installation

First, install the entry script with npm, yarn, or pnpm:

npm i --save @local-logic/sdks-js
yarn add @local-logic/sdks-js
pnpm add @local-logic/sdks-js

The script is also available in umd and es format from the Local Logic CDN: https://sdk.locallogic.co/sdks-js/<VERSION>/index.<FORMAT>.js

<VERSION> is the latest script version number (which you can find on npm), and <FORMAT> is either umd or es.

<script
async
src="https://sdk.locallogic.co/sdks-js/1.11.5/index.umd.js"
onload="myInitLocalContentFunc()"
></script>

Usage

Step 1: Instantiate an LLSDKsJS instance

Import LLSDKsJS and create a new localLogicSDK instance. If you installed LLSDKsJS using a script tag, you must access it from the window object.

import LLSDKsJS from "@local-logic/sdks-js";
const localLogicSDK = LLSDKsJS(
// Your API key or token
<API_KEY>
);

Step 2: Instantiate a Location Report instance

Next, create an instance of Location Report. You must define a container element for it to render into.

// Define a container element
const container = document.createElement("div");
const options = {
lat: 37.8,
lng: -122.4,
addressLabel: "5605 Ave de Gaspé, Montreal, QC",
};
document.body.appendChild(container);
localLogicSDK.create("lat-entry", container, options);

React applications

The SDKs are designed to work with React and other declarative frameworks.

Example

import { useRef, useEffect } from "react";
import LLSDKsJS from "@local-logic/sdks-js";
const localLogicSDK = LLSDKsJS(<API_KEY>);
function MyLocalContentComponent() {
const containerRef = useRef(null);
useEffect(() => {
if (!containerRef.current) {
return;
}
const options = {
lat: 37.8,
lng: -122.4,
addressLabel: "5605 Ave de Gaspé, Montreal, QC"
};
const localContent = localLogicSDK.create(
"local-content",
containerRef.current,
options
);
// It is important to destroy the Local Content instance when the component is unmounted.
return () => {
localContent.destroy();
}
}, []);
return (
<div ref={containerRef} />
);
}
export default MyLocalContentComponent;

Options

OptionsNotesTypeRequired
latLatitudeStringWhen not using includeSearchAddress
lngLongitudeStringWhen not using includeSearchAddress
addressLabelLocation addressStringWhen not using includeSearchAddress
localeReport language"en" or "fr"
brokerNameMust also specify the brokerEmail and brokerPhoneString
brokerPhoneMust also specify the brokerName and brokerEmailString
brokerEmailMust also specify the brokerName and brokerPhoneString
brokerageNameMust also specify the brokerageLogo and brokerageWebsiteString
brokerageLogoURL to a png or jpg. Must also specify the brokerageName and brokerageWebsiteString
brokerageWebsiteMust also specify the brokerageName and brokerageLogoString
imageSDK banner pictureString
titleSDK titleString
textLine1SDK first line of textString
textLine2SDK second line of textString
buttonTextSDK button textString
includeSearchAddressAdds address search input which can be used in place of lat, lng and addressLabel. Ideal for non-listing pagesBoolean

Appearance

Local Logic SDKs support visual customization using the Appearance API, which allows you to match the look of the SDK to your brand.

Themes

The SDKs currently offer two themes out of the box: day and night. The default mode is day, but you may wish to use the night theme if your application supports a dark mode.

const localLogicSDK = LLSDKsJS(
<API_KEY>,
{
appearance: { theme: "night" }
}
);

Variables

The entire theme can be further customized using the variables option.

The following example changes the primary color, font, and gives the UI a more rounded appearance.

const localLogicSDK = LLSDKsJS(
<API_KEY>,
{
appearance: {
variables: {
"--ll-color-primary": "#fd3958",
"--ll-color-primary-variant1": "#d5405b",
"--ll-border-radius-small": "8px",
"--ll-border-radius-medium": "16px",
"--ll-font-family": "Avenir, sans-serif",
}
}
}
);

You can find a list of appearance variables here.

Browser support

The SDKs are configured with to support these browsers.

Versioning

The SDKs are designed to receive most new changes (non-breaking features and bug fixes) without the need for a developer to manually update the script.

TypeScript

Local Logic SDKs JS comes packaged with TypeScript declarations.

FAQ

Q: How do I change the language of the SDK?

A: You can change the language by specifying locale in the LLSDKsJS options. The supported options are "en" and "fr".

const localContent = localLogicSDK.create(
"lat-entry",
containerRef.current, {
..., // Other config options here
}
);

Q: How do I disable lazy load?

A: Lazy loading is enabled by default. In some situations, you may want to disable lazy loading or control lazy loading with your own scripts.

To disable lazy load, pass lazy: false to the renderOptions parameter.

const localContent = localLogicSDK.create(
"lat-entry",
container,
{ ... },
// renderOptions
{
lazy: false
}
);
© Local Logic 2023