Create activity for anonymous user

Keith Murphy asked on March 28, 2014 10:33

So by adding code found here http://devnet.kentico.com/docs/onlinemarketingguide/index.html?internals_api_cm_examples_activities.htm to the GetMediaFile.aspx.cs file I've been able to create an activity for known users when the download something from the media library. I can not seem to figure out how best to do this to anonymous users. I assume I want to create a contact based on IP, but I can't seem to make it work. Do you have any code samples?

Recent Answers


Richard Sustek answered on April 1, 2014 03:11

Hi Keith,

Thank you for your message.

You are free to create your own contacts and set their name as their IP as you mentioned.

Sample can be:

        ContactInfo newContact = new ContactInfo()
        {
            ContactLastName = "My New Contact",
            ContactFirstName = "My New Firstname",
            ContactSiteID = CMSContext.CurrentSiteID,
            ContactIsAnonymous = true
        };

        // Save the contact
        ContactInfoProvider.SetContactInfo(newContact);

Let me know if you have further questions.

Kind regards,

Richard Sustek

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.