• Platforms
  • Partners
  • Forums
  • 日本語
  • TLC Tealium Learning Center Tealium Learning
    Community
  • Discussions & Ideas Dicussions & Ideas
  • Product Guides Product Guides
  • Knowledge Base Knowledge Base
  • Developer Docs Developer Docs
  • Education Education
  • TLC Blog TLC Blog
  • Support Desk Support Desk
  • CDH Customer Data Hub Customer Data Hub
  • Mobile
  • Getting Started
    • Overview
    • Quick Start Guide
    • Mobile Concepts
    • Client-Side
    • Server-Side
    • Tracking Webviews
    • Data Layer
    • Consent Management
    • Event Batching
    • User Location and Geofencing
    • Media Tracking
    • Deep Links
    • Timed Events
    • Trace
    • Hosted Data Layer
    • Adobe Visitor Service Module
    • Feature Comparison
    • Troubleshooting
  • Remote Commands
    • Overview
    • How It Works
    • Integrations
      • Adjust
      • AppsFlyer
      • Branch
      • Braze
      • Contentsquare
      • Facebook
      • Firebase
      • Kochava
      • Usabilla
  • Android (Java)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Module
      • Optimizely X Tracking Module
    • Android TV
    • Android Wear
    • API Reference
      • ConsentManager
      • DataSources
      • Lifecycle
      • Tealium
      • Tealium.Config
      • TealiumLocation
    • Release Notes
  • Android (Kotlin)
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • Identity Resolution
    • Module List
      • Ad Identifier Module
      • AutoTracking Module
      • AdobeVisitorService Module
      • Collect Module
      • Collectors Module
      • Crash Reporter Module
      • In-App Purchase Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Manager Module
      • Media Module
      • RemoteCommands Module
      • Tag Management Dispatcher Module
      • Visitor Service Module
    • Android TV
    • API Reference
      • ConsentCategory
      • ConsentManager
      • CurrentVisit
      • DataLayer
      • Lifecycle
      • LocationManager
      • Media
      • Tealium
      • TealiumConfig
      • VisitorProfile
      • VisitorService
    • Release Notes
  • Cordova 1.x
    • Overview
    • Install
    • Track
    • Data Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
    • API Reference
    • Release Notes
  • Cordova 2.x
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Flutter 1.x
    • Overview
    • Install
    • Track
    • Consent Management
    • Data Management
    • API Reference
    • Release Notes
  • Flutter 2.x
    • Overview
    • Install
    • Track
    • Consent Management
    • Data Management
    • API Reference
      • Tealium
      • TealiumConfig
      • VisitorProfile
    • Release Notes
  • iOS (Objective-C)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Tag Management
    • Module List
      • Lifecycle Tracking Module
    • tvOS
    • watchOS
    • API Reference
    • Release Notes
  • iOS (Swift) 1.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • App Extensions
    • Identity Resolution
    • Consent Management
    • Modules
    • Module List
      • AppData Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DataSource Module
      • DefaultStorage Module
      • Delegate Module
      • DeviceData Module
      • DispatchQueue Module
      • FileStorage Module
      • Lifecycle Module
      • Location Module
      • Logger Module
      • PersistentData Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
      • VolatileData Module
    • Feature Comparison
    • Working with Objective-C
    • API Reference
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManagerDelegate
      • TealiumConsentManager
      • TealiumInstanceManager
      • TealiumPersistentData
      • TealiumVolatileData
      • Tealium
    • Release Notes
  • iOS (Swift) 2.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • App Extensions
    • Identity Resolution
    • Modules
    • Module List
      • AppData Module
      • AdobeVisitorService Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DeviceData Module
      • In-App Purchase Module
      • Lifecycle Module
      • Location Module
      • Media Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
    • Working with Objective-C
    • API Reference
      • LocationModule
      • MediaSession
      • Tealium
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManager
      • TealiumDataLayer
      • TealiumInstanceManager
    • Release Notes
  • NativeScript
    • Overview
    • Install
    • Track
    • API Reference
      • Tealium
      • TealiumConfig
    • Release Notes
  • React Native 1.x
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • React Native 2.x
    • Overview
    • Install
    • Track
    • Location Module
    • API Reference
    • Release Notes
  • Unity 1.x
    • Overview
    • Install
    • Track
    • API Reference
  • Unity 2.x
    • Overview
    • Install
    • Track
    • API Reference
  • Xamarin 1.x
    • Overview
    • Install
    • Track
    • Data Management
    • Consent Management
    • API Reference
    • Release Notes
  • Xamarin 2.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • API Reference
    • Release Notes
  • Web
  • Getting Started
    • Overview
    • Quick Start Guide
    • Web Concepts
    • Data Layer
      • An Introduction to the Data Layer
      • How the Data Layer Works for Websites
      • Data Layer Best Practices
      • Definitions
        • Retail
        • Publisher
        • Hotel
        • Travel
        • Basic Video Tracking
  • Adobe Launch
    • Overview
    • Install
    • Data Layer
  • AMP
    • Overview
    • Install
    • Track
    • Data Layer
  • Angular
    • Overview
    • Install
    • Track
    • API Reference
  • Google Tag Manager
    • Overview
    • Install
    • Data Layer
  • JavaScript (Web)
    • Overview
    • Install
    • Track
    • Data Layer
    • Universal Data Object (utag_data)
    • Universal Tag (utag.js)
    • Data Layer Object (b)
    • Single-Page Applications
    • Settings
    • Debugging
    • API Reference
      • Cookie Functions
      • GDPR Functions
      • Tracking Functions
      • Utility Functions
    • Release Notes
  • Server
  • C#
    • Overview
    • Install
    • Track
    • Data Layer
    • API Reference
    • Release Notes
  • HTTP API
    • Overview
    • Endpoint
    • Data Layer
  • Java
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Node
    • Overview
    • Install
    • Track
    • API Reference
  • Python
    • Overview
    • Install
    • Track
    • API Reference
  • Roku
    • Overview
    • Install
    • Track
    • API Reference
  • Ruby
    • Overview
    • Install
    • Track
    • API Reference
IOS SWIFT V1 IOS SWIFT V1/MODULE LIST

Location Module

Provides device location data for your events and the ability to add geofences around points of interest.

The Location module enables your iOS app to receive location information and the ability to configure and monitor geofences. Learn more about location tracking and geofencing.

Supported Platforms

The following platforms are supported:

  • iOS

Requirements

  • Tealium for Swift (1.9.0+)

Sample App

Explore the iOS sample app to familiarize yourself with our library, tracking methods, and best practice implementation. The main sample app includes the Location module.

Install

Install the Location module with Swift Package Manager, CocoaPods or Carthage.

Swift Package Manager (Recommended)

To install the Location module with SPM:

  1. Add a Swift Package within Xcode or the command line tool using the repository: https://www.github.com/Tealium/tealium-swift

  2. If using Xcode, select the TealiumLocation target in the installation process. If using the command line, add the TealiumLocation module in the list of dependencies within the Package.swift file.

The framework is auto-instantiated. It has a dependency on TealiumCore and requires a dispatcher (TealiumCollect or TealiumTagManagement). No additional import statements are necessary.

Learn more about the SPM installation for iOS.

CocoaPods

To install the Location module with CocoaPods add the following pod to your Podfile:

pod 'tealium-swift/TealiumLocation'

The framework is auto-instantiated. It has a dependency on the TealiumCore pod and requires a dispatcher (TealiumCollect or TealiumTagManagement). Learn more about the CocoaPods installation for iOS.

Carthage

To install the Location module with Carthage:

  1. Go to the app target’s General configuration page in Xcode.

  2. Add the following framework to the Embedded Binaries section:

    TealiumLocation.framework
    

    The framework is auto-instantiated. It has a dependency on TealiumCore and requires a dispatcher (TealiumCollect or TealiumTagManagement). No additional import statements are necessary. Learn more about the Carthage installation for iOS.

Initialize

Location tracking is enabled by default when the module is added to your app. Configuration options for location accuracy and geofencing are set using properties of an instance of TealiumConfig.

Permissions

To authorize your app to collect location information, add the following keys to your app’s Info.plist file:

  • Privacy - Location When In Use Usage Description
  • Privacy - Location Always and When In Use Usage Description

If the keys are not present, location requests fail immediately. Learn more about requesting authorization for location services.

Location Tracking

The Location module performs continuous location tracking. Location updates are based on two settings: accuracy and distance.

By default, only significant location updates are monitored. This results in fewer updates and less battery consumption.

To enable higher accuracy updates, set the useHighAccuracy property to true and set the updateDistance property to a value in meters at which to trigger updates.

func start() {
      let config = TealiumConfig(account: "ACCOUNT",
                                 profile: "PROFILE",
                                 environment: "ENVIRONMENT",
                                 datasource: "DATASOURCE",
                                 optionalData: nil)
      config.useHighAccuracy = true
      config.updateDistance = 150
      //...
  }

Geofencing

To enable geofencing, use one of the following methods to provide your geofence JSON file:

  • Hosted URL
    Use your own hosted geofences file, provided as a URL to the property geofenceUrl.
    This option is recommended if you have overridden the publish settings URL or want to use Hosted Data Layer.

    config.geofenceUrl = "https://example.com/geofences.json"
    
  • Local File
    Use a geofences file stored in your app by setting the property geofenceFileName. Omit the file extension.

    config.geofenceFileName = "geofences" // geofences.json
    

Additional Considerations

Number of Active Geofences
Geofences are added and removed dynamically, using as few resources as possible. There is no limit to the number of geofences defined, but the number of active geofences is limited to 20 per device user across all running applications.

Initializing Geofences
If a user is within a geofence at the time of creation, the "enter" transition event does not fire. This is because "exit" and "enter" transition events are fired when crossing the perimeter and not when materializing inside.

Data Layer

The following variables are populated by the Location module as part of the mobile data layer. These variables are included automatically in each tracking call from the library.

Variable Name Type Description Example
latitude String The latitude of the user’s most recently recorded location "32.906119"
longitude String The longitude of the user’s most recently recorded location "-117.2367"
location_accuracy String The accuracy setting for the Location module, such as "high" or "low" "high"

During geofencing, a tracking call containing location data is sent when the transition state of the user changes. Transition state changes include a user entering or exiting a geofence. The following additional variables are sent to the data layer:

Variable Name Type Description Example
tealium_event String The Tealium tracked geofence event "geofence_entered" or "geofence_exited"
geofence_name String The name of the geofence region "Tealium_San_Diego"
geofence_transition_type String The type of geofence transition event "geofence_entered" or "geofence_exited"
movement_speed String The instantaneous speed of the device, measured in meters per second "1.0"
location_timestamp String The recorded date/time (GMT) the user entered/exited the geofence region "2020-01-28 16:29:46 +0000"

API Reference

For the reference of methods used in the Location module, see the TealiumConfig class in the Tealium SDK for iOS API.

"Lifecycle Module "
Previous
Lifecycle Module
Next
Logger Module
"Logger Module"

 

Was this article helpful?

This page was last updated: May 13, 2022      

Thank you for your feedback!

Table of Contents

  • Supported Platforms
  • Requirements
  • Sample App
  • Install
    • Swift Package Manager (Recommended)
    • CocoaPods
    • Carthage
  • Initialize
    • Permissions
  • Location Tracking
  • Geofencing
  • Additional Considerations
  • Data Layer
  • API Reference
  • Platforms
  • Partners
  • Forums
  • Mobile
  • Getting Started
  • Remote Commands
  • Android (Java)
  • Android (Kotlin)
  • Cordova 1.x
  • Cordova 2.x
  • Flutter 1.x
  • Flutter 2.x
  • iOS (Objective-C)
  • iOS (Swift) 1.x
  • iOS (Swift) 2.x
  • NativeScript
  • React Native 1.x
  • React Native 2.x
  • Unity 1.x
  • Unity 2.x
  • Xamarin 1.x
  • Xamarin 2.x
  • Web
  • Getting Started
  • Adobe Launch
  • AMP
  • Angular
  • Google Tag Manager
  • JavaScript (Web)
  • Server
  • C#
  • HTTP API
  • Java
  • Node
  • Python
  • Roku
  • Ruby