Getting Started

Project setup

Install the package

yarn add google-fls # or npm i google-fls

fls_global is the function used to generate the Google tag. Below we can see how the function is composed:

fls_global(isCookiesFriendly, config, activitySettings, customVariables)

Let's start with a basic setup, firstable we have to import React and useEffect to make all possible. After that we can use fls_global inside useEffect to load the function at the first load page.

import React, {useEffect} from 'react'
import fls_global from 'google-fls' // import google-fls
function App() {
useEffect(() => {
fls_global(true, // isCookiesFriendly true or false
{
format: 'global', // supported format: global, iframe and image
advertiser_id: 8384813 // Advertiser ID
}, {
type: 'test', // Type
cat: 'test' // Cat
})
}, [])
return (
<>
Test Application
</>
)
}
export default App;

Now, let's see as the function is build.

ValueTypeRequiredDescription
isCookiesFriendlyBoolenTrueUsed to activate o deactivate Google's cookies. If you set it false the tag will not trigger.
configObjectTrueSet-up yor format and advertiser_id
activitySettingsObjectTrueSet-up yor type and cat
customVariablesObjectFalseSet-up yor custom variables here

format supported are: global, iframe and image.