Skip to content

stape-io/klaviyo-lookup-variable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Klaviyo Lookup Variable for GTM Server Side

This Google Tag Manager Server-Side variable allows you to retrieve a user profile from Klaviyo using the identifier (_kx). It enriches your server-side data with user information such as email, phone number, and address.

How it works

  1. Identifier Detection: The variable first looks for the _kx query parameter in the page URL.
  2. Fallback: If the URL parameter is not present, it attempts to retrieve the identifier from the stape_klaviyo_kx cookie.
  3. Cache Check: The variable checks the templateDataStorage to see if the user data for this identifier is already cached, preventing unnecessary API calls.
  4. API Request: If no cache is found, it sends a GET request to the Klaviyo Profiles API.
  5. Output: It returns either the user's email or a full user data object based on your configuration.

Parameters

  • Api Key: Input your Klaviyo Private API Key. This is required to authorize the request.
  • Output: Select the type of data to return:
    • Email: Returns only the user's email address string.
    • All user_data: Returns a JSON object containing the user profile.
  • Logs Settings: Control logging behavior:
    • Do not log: No logs are generated.
    • Log to console during debug and preview: Logs only when GTM is in debug/preview mode.
    • Always log to console: Logs requests and responses regardless of the environment.

Returned Data Structure

If All user_data is selected, the variable returns an object containing the following attributes:

{
  "email": "[email protected]",
  "phone_number": "+1234567890",
  "address": [
    {
      "first_name": "john",
      "last_name": "doe",
      "street": "123 main st",
      "city": "new york",
      "postal_code": "10001",
      "country": "us"
    }
  ]
}

Open Source

Initial development was done by Lars Friis.

Klaviyo Lookup Variable for GTM Server Side is developing and maintained by Stape Team under the Apache 2.0 license.

About

Klaviyo Lookup Variable for Google Tag Manager Server Container

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •