1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to set custom client ID?

Discussion in 'Google Analytics' started by luigi777, Jul 31, 2013.

  1. #1
    Hi everybody,

    I was wondering how it is possible to specify a custom ClientID

    My users first have to register and next on my thankyou page the user has a unique Id assigned to him. like this: http://mysite.com/thankyou/index.php?guid=6C9CF45A-D316-41EA-92B0-B6FD078077CC
    At this point I want to store this GUID from the url as the ClientId of the user. How do I do this?
    I tried with this code:
    First I grabbed the id from the url
    <?php
    $guid
    = $_GET['guid'];?>

    and then I added this into the GA script:
    ga('create','UA-42733428-1',{'clientId':'<?php echo $guid; ?>'});

    However this seems not to be working, as I don't see the id appear in the GA cookie.

    Thank you!
     
    luigi777, Jul 31, 2013 IP
  2. scottlpool2003

    scottlpool2003 Well-Known Member

    Messages:
    1,708
    Likes Received:
    49
    Best Answers:
    9
    Trophy Points:
    150
    #2
    Encode it with JSON then output it into the Javascript.
     
    scottlpool2003, Jul 31, 2013 IP
  3. luigi777

    luigi777 Active Member

    Messages:
    429
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    I don't know JSON, can you give me the code I can use??
     
    luigi777, Jul 31, 2013 IP