How to log a custom event with parms using Facebook analytics using swift

Mike Bailey

I know this a basic question, but I can't work out how to log a custom event with custom parameters using facebook analytics. For example, I would like to log the following:

  • song played
  • title
  • artist

Please see the below code (which does not work):

    let dict = AppEvent.ParametersDictionary(AppEventParameterName.Custom("title), AppEventParameterName.Custom("artist"))

    AppEvent.ViewedContent(contentType: "test", contentId: "test", extraParameters: dict)

I get the error message:

"Cannot invoke value of type 'ParametersDictionary.Type' (aka 'Dictionary.Type') with argument list '(AppEventParameterName, AppEventParameterName)"

I have also tried:

let dict = AppEvent.ParametersDictionary(AppEventParameterName.Custom("title"), "test") 

Any help would be greatly appreciated.

Daniel Hsu

As mentioned in the documentation, the dictionary needs to be of type [AppEventParameterName : AppEventParameterValueType].

You can construct the dictionary like:

[.Custom["Song Played]: "Sunday Morning", .Custom["Artist"]: "Maroon 5"]

Then just input it into the AppEventsLogger log call like this:

AppEventsLogger.log("trackedNewSong", parameters: dictionary, valueToSum: nil, accessToken: nil), where "trackedNewSong" would be the event you are logging and the parameters you are attaching to it are embedded in the dictionary.

Hope this helps!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to view parameters on firebase console while logging custom event using firebase analytics?

From Dev

How to get user email using firebase analytics event parameter?

From Dev

how to login with facebook with custom login button using facebook sdk

From Dev

How to add an event in the device calendar using swift?

From Dev

How to set Custom Dimension in Google Analytics using Angulartics

From Dev

How to log into web site using uiwebview with swift?

From Dev

Using Google Analytics with Swift on iOS

From Dev

How to add a custom event tracking with Google Analytics

From Dev

trying to log into facebook using VBA

From Dev

Android log in app using Facebook

From Dev

Export Custom Event Dimensions to SQL from Application Insights using Stream Analytics

From Dev

Export Custom Event Dimensions to SQL from Application Insights using Stream Analytics

From Dev

MobileFirst7.1 Analytics - How to log custom analytics

From Dev

How to add App Analytic to Login event using Facebook SDK

From Dev

Python3 How would I log in Facebook using requests

From Dev

How to gradient fill custom UIView using Swift?

From Dev

Event Tracking Using Google Universal Analytics

From Dev

Login with Facebook using custom button

From Dev

How can I query the event log for a specific source using xpath?

From Dev

Oracle : How to Log Table Rename Event using DDL Trigger

From Dev

How can I query the event log for a specific source using xpath?

From Dev

Oracle : How to Log Table Rename Event using DDL Trigger

From Dev

How to post a custom post using facebook javascript api

From Dev

Using Facebook Messenger SDK in Swift

From Dev

Using and querying Custom Dimensions in Google Analytics API

From Dev

Using custom variables to group events in Google Analytics

From Dev

using custom event listener java

From Dev

Using Vue Prototypes for Custom Event

From Dev

how to get posts from facebook page using GraphAPI in swift

Related Related

  1. 1

    How to view parameters on firebase console while logging custom event using firebase analytics?

  2. 2

    How to get user email using firebase analytics event parameter?

  3. 3

    how to login with facebook with custom login button using facebook sdk

  4. 4

    How to add an event in the device calendar using swift?

  5. 5

    How to set Custom Dimension in Google Analytics using Angulartics

  6. 6

    How to log into web site using uiwebview with swift?

  7. 7

    Using Google Analytics with Swift on iOS

  8. 8

    How to add a custom event tracking with Google Analytics

  9. 9

    trying to log into facebook using VBA

  10. 10

    Android log in app using Facebook

  11. 11

    Export Custom Event Dimensions to SQL from Application Insights using Stream Analytics

  12. 12

    Export Custom Event Dimensions to SQL from Application Insights using Stream Analytics

  13. 13

    MobileFirst7.1 Analytics - How to log custom analytics

  14. 14

    How to add App Analytic to Login event using Facebook SDK

  15. 15

    Python3 How would I log in Facebook using requests

  16. 16

    How to gradient fill custom UIView using Swift?

  17. 17

    Event Tracking Using Google Universal Analytics

  18. 18

    Login with Facebook using custom button

  19. 19

    How can I query the event log for a specific source using xpath?

  20. 20

    Oracle : How to Log Table Rename Event using DDL Trigger

  21. 21

    How can I query the event log for a specific source using xpath?

  22. 22

    Oracle : How to Log Table Rename Event using DDL Trigger

  23. 23

    How to post a custom post using facebook javascript api

  24. 24

    Using Facebook Messenger SDK in Swift

  25. 25

    Using and querying Custom Dimensions in Google Analytics API

  26. 26

    Using custom variables to group events in Google Analytics

  27. 27

    using custom event listener java

  28. 28

    Using Vue Prototypes for Custom Event

  29. 29

    how to get posts from facebook page using GraphAPI in swift

HotTag

Archive